dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Access of undefined property

Hybrid View

  1. #1
    Member
    Join Date
    Nov 2005
    Posts
    96

    Access of undefined property

    Just got CS3 today and love many of the new features, however I’m having some issues with MC's that I was using as Buttons in AS2.

    Here is the code I’m using for the buttons is AS2

    Code:
    ratesBtn.onRollOver = function() {
    	ratesBtn.gotoAndStop("over");
    	_root.ratesBtnHolder.gotoAndPlay("in");
    }
    ratesBtn.onRollOut = function() {
    	ratesBtn.gotoAndStop("off");
    	_root.ratesBtnHolder.gotoAndPlay("out");
    }

    When I export the movie now, I get this error and all the movies that contain motion tween within them just start looping, however each of them have stop(); tags within them

    1120: Access of undefined property _root.

    with the source as

    _root.ratesBtnHolder.gotoAndPlay("in");


    any iders????

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    You have to change your settings to publish to ActionScript 2, not ActionScript 3.

  3. #3
    Member
    Join Date
    Nov 2005
    Posts
    96
    I figured that out quickly…Is AS3 a completely different language?

  4. #4
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    Quote Originally Posted by rstar
    I figured that out quickly…Is AS3 a completely different language?
    Pretty much. A lot of it is similar, but chances are code you write in AS2 is not going to work in AS3. Here's an example that will work in both, though:
    Code:
    stop();


    ActionScript 3 even uses a new virtual machine to run ActionScript 3, so unlike AS2, which can communicate between AS2 and AS1 movies, AS3 cannot (unless you use localConnection as a workaround)

  5. #5
    Pushing the boundaries>>
    Join Date
    May 2007
    Location
    South Africa
    Posts
    8
    Your As3 code for this would look like:

    function rollOverFunction(evt:MouseEvent) {
    trace("Rolled Over!");
    }
    myButton.addEventListener(MouseEvent.ROLL_OVER, rollOverFunction);

    Go here to learn more about EventListeners
    http://www.communitymx.com/content/a....cfm?cid=76FDB
    http://as3.betaruce.com/tut/tut_3/tut_3.html

    Learn Actionscript 3:
    http://flashas3.flashscript.biz/AS3_...roduction.html

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