Hi
I am loading swfs from a backend server that are produced by our own
renderer. If I simply load these swfs into an image the background colour
form the swf floods the whoel stag enad makes it impossible to see anything
other than the last one to load.
I need to mask the swfs so we just see what we are supposed to.
I found an example in the help for the DisplayObject class. It seemed to do
everything that I wanted - it used a Sprite, drew a rectangle on it, added
it as a child then set it as a mask.
However when I try this when the addchild function is called saying that it
cannot convert the Sprite to a Display object:
Type Coercion failed: cannot convert flash.display::[EMAIL PROTECTED] to
mx.core.IUIComponent.
What am doing wrong? I hope someone can help.
The example I was looking at is:
import flash.text.TextField;
import flash.display.Sprite;
import flash.events.MouseEvent;
var tf:TextField = new TextField();
tf.text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
+ "sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. "
tf.selectable = false;
tf.wordWrap = true;
tf.width = 150;
addChild(tf);
var square:Sprite = new Sprite();
square.graphics.beginFill(0xFF0000);
square.graphics.drawRect(0, 0, 40, 40);
addChild(square);
tf.mask = square;
tf.addEventListener(MouseEvent.MOUSE_DOWN, drag);
tf.addEventListener(MouseEvent.MOUSE_UP, noDrag);
function drag(event:MouseEvent):void {
square.startDrag();
}
function noDrag(event:MouseEvent):void {
square.stopDrag();
}
Giles Roadnight