A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: How do I convert this code to Actionscript 2.0

  1. #1
    Member
    Join Date
    Oct 2000
    Location
    Los Angeles
    Posts
    71

    How do I convert this code to Actionscript 2.0

    Silly newbie question, but what is the proper syntax for this OLD style code in the new and improved 2.0?

    on (release) {
    tellTarget (this._parent.stars) {
    gotoAndPlay(2);
    }
    }

    Thanks
    ---------------
    bytemonster

  2. #2
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    Well..that looks like flash 5 or prevoius. You might try this
    code:
    this.onRelease = function() {
    with (this._parent.stars) {
    gotoAndPlay(2);
    }
    };

    or
    code:
    this.onRelease = function() {
    this._parent.stars.gotoAndPlay(2);
    };

    not exactly as2 but it is as2 compliant.
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  3. #3
    Member
    Join Date
    Oct 2000
    Location
    Los Angeles
    Posts
    71
    Do I just attach that to the button? It doesn't seem to work!?!

    Can't I do something like:

    this.onRelease(this._parent.stars.gotoAndPlay(2));

    ??

    That doesn't seem to work, but is there some syntax like that that will?
    Last edited by bytemonster; 08-26-2004 at 07:23 PM.
    ---------------
    bytemonster

  4. #4
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Originally posted by bytemonster
    Do I just attach that to the button? It doesn't seem to work!?!

    Can't I do something like:

    this.onRelease(this._parent.stars.gotoAndPlay(2));

    ??

    That doesn't seem to work, but is there some syntax like that that will?
    Nope.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  5. #5
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    give the button an instance name and then in the frame that contains the button use,

    code:

    instanceNameOfButton.onRelease = function() {
    this._parent._parent.stars.gotoAndPlay(2);
    };



    I think you'll need 2 _parent's in the path since using the syntax above "this" will be a reference to the button - not the timeline that contains the button, as it would be using the on (release) syntax.

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