A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: as2 to as3 code translation please

  1. #1
    Knowsnothingaboutnothing
    Join Date
    Dec 2008
    Location
    Guatemala
    Posts
    42

    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!

  2. #2
    Senior Member guardiankitty's Avatar
    Join Date
    Dec 2006
    Location
    Here
    Posts
    215
    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

  3. #3
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    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 = new content_box();
    addChild(v)
    v.1;
    v.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.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  4. #4
    Knowsnothingaboutnothing
    Join Date
    Dec 2008
    Location
    Guatemala
    Posts
    42
    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

  5. #5
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    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.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center