Larry Zhang escreveu:
>
> Hello all
>
> I find it strange when I try to add some display object in Flex 
> Canvas. This is the situation
>
> First, I have an Image named “img1” in a.mxml which is a Canvas; I 
> name it “ca”. Then I send the img1 out by some function to another 
> Canvas b.mxml; I name it “cb”. After I added the img1 to cb by 
> *cb.addChild(img1)*, I found the image showed up in cb but disappeared 
> in ca. Then I use *ca.contains(img1)* to check if ca still has the 
> img1, it returned *true*. But, where the img1 in ca went?
>
> Can anybody help me with the strange problem?
>
> Thanks very much.
>
> ==============================
>
> Make Every Day Count
>
> Larry Zhang
>
> 
>
> __________ NOD32 2755 (20071229) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
I run into the same issue before. Variables in Flex are passed by 
reference, not by value. If you do something like fooFunction(fooVar) 
you'r just passing a reference to the content of fooVar.
In order to add the same component to different containers you have to 
make a clone, or in your case it's easier to just have the source of 
img1 as a parameter and create another Image with the same source.

Regards,

Frederico Garcia


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to