Results 1 to 5 of 5

Thread: ActionScript 3 beginner having problem

  1. #1
    Join Date
    Nov 2009
    Posts
    37

    ActionScript 3 beginner having problem

    I started in AS3 (ActionScript 3) and everything seems more complicated and time consuming to do in AS2 but I keep good. Can you help me how to start? Is there any problem in this little script

    Code:
    var sp:Sprite=new mc();
    sp.name="sp1";
    sp.life=100; // Error: Access to the property life can not be defined via a reference type static... 
    this.addChild(sp);

  2. #2
    Join Date
    Oct 2005
    Posts
    2,394

    Re: ActionScript 3 beginner having problem

    you already type your object into another, even if it is extended it is cleaner type in the class

    var sp:Sprite = new Sprite();

    var sp:mc = new mc();

    well then you have property in your life object mc?

  3. #3
    Join Date
    Nov 2009
    Posts
    37

    Re: ActionScript 3 beginner having problem

    These 2 lines together does not work, only the 2nd password. How does it if the life and property is in my object mc? TM is a clip (actually a class with export for actionscript checked). In AS2 you could add in the script as variable they wanted to be attached when a clip on the stage, eg after a mc = attachMovie (....)
    mc.life6;
    mc.energy = 100;
    etc. ... there was nothing else to do.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,394

    Re: ActionScript 3 beginner having problem

    And yes but you must have now created an object or class

    var obj:object = new Object()
    obj.clip = new mc();
    obj.energy = 100

    addChild(obj.clip)

  5. #5
    Join Date
    Nov 2009
    Posts
    37

    Re: ActionScript 3 beginner having problem

    Well, AS3 messes up everything! Fun all these tips, I'll try it myself and document over because finally there's a lot more changes than I thought.

    Actually it might work as AS2 is typing when that all happens.

    Code:
    var sp:mc=new mc(); //While with var sp:Sprite=new mc()... 
    addChild(sp);
    sp.life=10; //... this line would not work

Similar Threads

  1. How to convert Actionscript 2 to actionscript 3
    By Bol-Bacchan in forum Software Development
    Replies: 4
    Last Post: 17-01-2011, 06:59 AM
  2. Is it possible to write ActionScript 2 in Adobe CS5
    By B-JOB Guru in forum Windows Software
    Replies: 3
    Last Post: 16-01-2011, 05:09 AM
  3. Want to learn ActionScript.....What to Refer?
    By Andrzej in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 11:12 AM
  4. ActionScript in Flash CS3
    By Manthan in forum Software Development
    Replies: 4
    Last Post: 08-07-2009, 10:18 PM
  5. Actionscript 3 Compiler ?
    By Xavier1234 in forum Software Development
    Replies: 3
    Last Post: 29-06-2009, 05:09 PM

Posting Permissions

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