使平滑的进口,旋转图像动态文本框闪光灯(AS3) [英] enable smoothing on imported, rotated image in dynamic text box in flash (AS3)
问题描述
我有在多数民众赞成旋转10°,一个动态文本框里面的舞台上影片剪辑。我加载一些文字,带有嵌入式图像转换成它是这样的:
(使用第一架AS3就目前而言,这最终将会进入一个类。)
VAR TXT:字符串='< IMG SRC =foo.gifID =myImg1/>< P> Lorem存有< / P>';
my_mc.txtBox.htmlText = TXT;
,工作正常。该文被放置,甚至环绕的形象很好。问题是,图像看起来太可怕了。我发现将Bitmap.smoothing财产,但似乎无法访问图像设置属性。我想这code:
VAR IMG:的DisplayObject = my_mc.txtBox.getImageReference('myImg1');
如果(typeof运算(IMG)!='不确定'){
img.contentLoaderInfo.addEventListener(引发Event.COMPLETE,onHtmlImageLoaded);
}
功能onHtmlImageLoaded(事件:事件):无效{
event.target.removeEventListener(引发Event.COMPLETE,onHtmlImageLoaded);
位图(event.target.content).smoothing = TRUE;
}
在img.contentLoaderInfo ......行抛出这个错误,虽然:
1119:对可能未定义的属性的内容,通过访问
静态类型flash.display使用一个参考:的DisplayObject。
试试这个:
VAR IMG:装载机=装载机(tx.getImageReference('proceso'));
img.contentLoaderInfo.addEventListener(引发Event.COMPLETE,onHtmlImageLoaded);
功能onHtmlImageLoaded(事件:事件):无效{
event.target.removeEventListener(引发Event.COMPLETE,onHtmlImageLoaded);
位图(event.target.content).smoothing = TRUE;
}
这是工作。
I've got a movie clip on the stage that's rotated 10°, with a dynamic text box inside. I'm loading some text, with an embedded image into it thus:
(Using 1st frame AS3 for now, eventually this will go in a class.)
var txt:String = '<img src="foo.gif" id="myImg1" /><p>Lorem ipsum</p>';
my_mc.txtBox.htmlText = txt;
Which works fine. The text gets placed, and even wraps around the image nicely. Problem is, the image looks horrible. I found the Bitmap.smoothing property, but can't seem to access the image to set the property. I'm trying this code:
var img:DisplayObject = my_mc.txtBox.getImageReference('myImg1');
if (typeof(img) != 'undefined') {
img.contentLoaderInfo.addEventListener(Event.COMPLETE, onHtmlImageLoaded);
}
function onHtmlImageLoaded(event:Event):void{
event.target.removeEventListener(Event.COMPLETE, onHtmlImageLoaded);
Bitmap(event.target.content).smoothing = true;
}
the 'img.contentLoaderInfo...' line throws this error, though:
1119: Access of possibly undefined property content through
a reference with static type flash.display:DisplayObject.
try this:
var img:Loader = Loader( tx.getImageReference('proceso') );
img.contentLoaderInfo.addEventListener(Event.COMPLETE, onHtmlImageLoaded);
function onHtmlImageLoaded(event:Event):void{
event.target.removeEventListener(Event.COMPLETE, onHtmlImageLoaded);
Bitmap(event.target.content).smoothing = true;
}
it's work.
这篇关于使平滑的进口,旋转图像动态文本框闪光灯(AS3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!