-
as2 to as3 code translation please
So I have this website that I want to do in AS3.. however I lack the as3 code to load a movie (user presses a button and the page related to that button e.g. Home pops a movie in a designated space). I have it in as2 which is:
PHP Code:
createEmptyMovieClip("content_box", 200);
content_box._x = 1;
content_box._y = 308;
What would be the equivalent of that in AS3? Thanks a million!
-
Senior Member
I am currently on a quest for this same issue....
This is what I have found out...
PHP Code:
//Create a new movieclip with the name of newmovieclip
var newmovieclip:MovieClip=new MovieClip();
//Place the newmovieclip onto the stage
addChild(newmovieclip).name="mymovieclip"
//The only way to interact with this new movie clip is getChildByName
//Which I find to be the dumbest F*CKING thing anyone has ever
//made up...
//check mymovieclip, if it has a name and an x position
trace(getChildByName("mymovieclip").name,getChildByName("mymovieclip").x)
//set a new x position
getChildByName("mymovieclip").x=500;
//check if it took
trace(getChildByName("mymovieclip").name,getChildByName("mymovieclip").x)
The is the primary reason alone that has made me not want to program with as3 (this and I find that the depths system in as3 is impossible to work with). I am trying to figure out how to load a swf movie into my document, inside of another movieclip... and no such luck (been looking for three strait days now)
good luck, and I will be checking up on this post, i need an answer too...
-gk
-
Developing For Dunkets
go to the library panel and right click on the object in the library and go to properties. Then give it a class name like content_box. It may tell you it cannot find the class and one will be generated for you. That's fine. Then in the actions panel:
PHP Code:
var v = new content_box(); addChild(v) v.x = 1; v.y = 308
You can control this box's properties like normal by refering to v. Hopefully that covers both of them...? But, you can control it just fine like:
var newmovieclip:MovieClip=new MovieClip();
//Place the newmovieclip onto the stage
addChild(newmovieclip).name="content_box" ;
trace(content_box);
Traces out your box class.
-
tyvm! I tested it and it worked fine - converting a site to as2 to as3 however is not fun! I dont even know if there are any benefits to it
-
Developing For Dunkets
Well, speed. But, unless you added something new that only AS3 can do then no benefits really. Except that AS3 seems to run a little faster on most things.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|