FORUMS: list search recent posts

Action Script 2.0 to 3.0 issue

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matt Serano
Action Script 2.0 to 3.0 issue
on Jan 31, 2011 at 11:32:11 pm

My pre-loader on my website is stuck in a loop now that I've put my project in CS5 from CS3. I don't know what but some code did not transfer over. I hate when they do that. I think I found it.

Can somebody look at this code and tell me if something is wrong with it? The movie clip "pages" is a movie clip that has my main content.


pages.gotoAndStop(_root.link);
_root.link = 0;
_root.scroller.gotoAndStop(2);


Return to posts index

Matt Serano
Re: Action Script 2.0 to 3.0 issue
on Jan 31, 2011 at 11:41:07 pm

The compiler said that the property _root is no longer supported. What is a good fix for this?

http://www.thecrossroadsoffate.com


Return to posts index

Brodd Nesset
Re: Action Script 2.0 to 3.0 issue
on Feb 2, 2011 at 9:14:40 am

In AS3, you don't write properties with an underscore first anymore, so it's root, not _root, x not _x etc. This is how they do it in most other programming languages too. Flash has adapted.

The general method which is recommended in your case is to use parent instead of root. Root is less flexible, more of a lock-in.
what complicates matters, is the new levels of abstraction now appearent in ActionScript. There are less assumptions, and because of that, sometimes more coding to do for some simple tasks.
AS3 has an abstract idea of what 'parent' might be; several types of objects are possible. While AS2 just assumes 'parent' is a MovieClip, you need to specify it in AS3.

The best syntax (IMO!) would be:

this.MovieClip(parent).gotoAndPlay("x");
...for reaching the MovieClip below the current. Note that in AS3, the Stage is mostly just another MovieClip too ... so you'd use this to reach the Stage (the old _root) as well.

this.MovieClip(parent).anotherMC.play();
...is for triggering one MC from another.



Not everything that can be counted counts, and not everything that counts can be counted.



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]