Unsubscribe Remove

On Oct 19, 2007, at 8:35 PM, keith wrote:

Is there a reason you can't access the Sprite with the variable you first created?
cont.visible=false;

-- Keith H --




Alistair Colling wrote:
Hiya everyone, good to see the list back up and running.

I'm trying to access a sprite that is inside of 2 other sprites and I have 2 questions about this:

1) It seems that the syntax for targeting this sprite once it is created is quite long winded (2 temporary vars have to be created):

var cont:Sprite = new Sprite();
this.addChild(cont);
var cont1:Sprite = new Sprite();
cont.addChild(cont1);
var child1:Sprite = new H1();

var target =cont.getChildByName("cont1");
var targ2 = target.getChildByName("child1");
targ2._visible = false;




2) Also, I can't data type my target var as a Sprite otherwise I get an error (unless I cast the type as well).

If anyone knows of a better of doing this I would be really interested to hear it :)
Cheers,
Ali



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to