Answering your last question first. MovieClips and Sprites are not
allowed willy nilly in Flex. The Flex framework allows UIComponents
only. If you control the UIComponent, you are welcome to put what
you want in it. Otherwise, you'll get an exception if you try to put
a Sprite or MovieClip inside a Canvas for example. So, you don't
"access MovieClip's and sprites that are in MXML". AS3 allows only
certain access to certain things; this isn't the benevolent AS2 / AS1
of yore that had no rules.
The Image class extends SWFLoader, and SWFLoader does some nice
abstraction of stuff that's loaded in it.
So, image.content could be:
- a loader
- an internal class
- a loaded asset (SWF, JPG, etc.)
If it's a Loader, you'd go:
image.content.content, and cast that to what it is; in your case, I
think Bitmap.
The only time Image.content isn't a loader is if you pass it a class
name (usually).
On Jan 17, 2007, at 5:09 PM, Merrill, Jason wrote:
Been trying to post this all day, but no luck.
How do I access the sprite/movieClip instance (not sure which it is,
since this is in the image class) of an image loaded into image tag
and then pass that to an actionscript method?
Basically, I have a repeater that loads dynamic images (based on XML
data) into an <mx:Image> tag. That works fine. I also have a
Reflection class (currently porting it from AS 2.0 to 3.0) which
applys a reflection effect to a movie clip's bitmap data, which also
works fine in plain old Flash. However in Flex, I know how to import
the class, but not how to tie the rendering of the different dynamic
images in my MXML with the Reflection class. I read the help docs on
mx.controls.image, and it seems like the image might be loaded into a
sprite instance, but how to I send that sprite instance to my
actionscript method right after the image loads?
Any ideas? Also, in general, how to do you access sprites or movie
clips on the stage created with MXML from Actionscript?
Jason Merrill
Bank of America
Learning & Organizational Effectiveness