OK!  Just got it.  For those who care, here's what I did:

It actually compiled and worked fine in the Flash 9 Alpha when I published from there, but I was actually shooting for the Flex 2 SDK.

I could only type the object as a Sprite it seems, because the container movieclip I had was only 1 frame, while the ones nested inside were multiple frames. I found that when I extended the one frame to be multiple frames, it worked just fine as a movieclip. I guess, and maybe this is a quirk of the alpha, that there's no such thing as a one frame movieclip - it can only be a sprite.

And then the nested clips, which I could access, I couldn't get to be MovieClips, only DisplayObjects. There was a syntax I wasn't aware of:
var clip:MovieClip = container.getChildByName("myclip") as MovieClip;

I'd never heard of "as", but it seemed to work great when I added it.

Thanks, and hope this helps someone else with similar problems!
ben

ben gomez farrell wrote:
I just figured it out, but now I have a new question. There's actually no code except for stop(); and the instantiation code in the actual Flash file. I took all this out, and it doesn't seem like a big deal to just convert the code. It's also a small project, so it's not going to be a big deal to change some of the syntax and type all my variables. I actually am upgrading because I want to use the byteArray class to save out a JPG.

Anyway, I've gotten so far as to finally figure out that I need to access the nested clips through the displayobject class by using getChildren, or getChildAt, or getChildByName.

My battle now is that I can't figure out why things are embedding the way they are.

I'm embedding the assets through a compiler directive: [Embed(source="assets.swf", symbol="gui_mc")] Even though it's a movieclip in the Flash Alpha, it won't type in the Flex SDK as a movieclip. The error says it's displayobject. I can actually get away with typing it as a Sprite.

And then I can access it's children if I say if I type the main movieclip as a sprite.

The nested clips on the other hand I can't type as anything but a display object unfortunately, which means I can't access it's frames.

So that's what I'm clueless on now! I've tried exporting out of Flash Alpha as AS2 and AS3, but I can't type things as a movieclip no matter what I do.

Thanks!
ben

Steven Sacks | BLITZ wrote:
If you're not using absolute strict typing and everything that AS3 has
(display, addChild, etc.), then you're gaining no benefit because Flash
will just kick down to VM1.

IMO, you should either rebuild it from scratch in AS3 style (using
sprites, display objects, etc.) or leave it as AS2 and save yourself the
headache.




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ben gomez farrell
Sent: Thursday, March 29, 2007 11:32 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Confused about accessing nested movieclips in AS3

Hey everyone, I've been working with AS3 for a bit, and been kind of avoiding this problem till now, but I've converting an AS2 project which has some nested clips, and I'd rather not change things!

So basically the question is how do I access nested clips? Before in AS2, I'd say myclip.nestedclip.othernestedclip.

But now the problem I have is that once I get a clip on stage I can't drill down to it's children with dot syntax. It gives an error that the nested MC is an undefined property. I suppose I could create a class for myclip that exposes it's nested clips as public variable - and do that for each nesting level, but that's a lot of work.

I also tried declaring it in my main class as private var myclip.nestedclip:MovieClip, but of course that's bad syntax.

If it matters, I'm exporting my assets out of the Flash 9 Alpha as a Flash 9 AS2 movie. (I tried AS3, but the ability to specify a linkage ID went away). Then I'm embedding the movieclips I need with the [Embed] tag through FlashDevelop and sending it over to the Flex 2 SDK compiler for output.

Anyway, this all works, and my stuff appears on stage, but I just can't get access to the nested clips!

thanks!
ben
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to