user2374577
user2374577

Reputation: 11

I'm trying to create a sliding gallery in AS3 in Flash CS5, but I get these errors: does it have something to do with AS3 ?

Scene 3, Layer 'AS', Frame 1, Line 1 1119: Access of possibly undefined property onEnterFrame through a reference with static type flash.display:DisplayObject. Scene 3, Layer 'AS', Frame 1, Line 2
1119: Access of possibly undefined property _ymouse through a reference with static type flash.display:DisplayObject. Scene 3, Layer 'AS', Frame 1, Line 3 1120: Access of undefined property myVar. Scene 3, Layer 'AS', Frame 1, Line 5 1119: Access of possibly undefined property _ymouse through a reference with static type flash.display:DisplayObject. Scene 3, Layer 'AS', Frame 1, Line 6
1120: Access of undefined property myVar. Scene 3, Layer 'AS', Frame 1, Line 8 1119: Access of possibly undefined property _xmouse through a reference with static type flash.display:DisplayObject. Scene 3, Layer 'AS', Frame 1, Line 8 1120: Access of undefined property myVar. Scene 3, Layer 'AS', Frame 1, Line 17 1119: Access of possibly undefined property _xmouse through a reference with static type flash.display:DisplayObject. Scene 3, Layer 'AS', Frame 1, Line 17 1120: Access of undefined property myVar. Scene 3, Layer 'AS', Frame 1, Line 24 1119: Access of possibly undefined property _xmouse through a reference with static type flash.display:DisplayObject. Scene 3, Layer 'AS', Frame 1, Line 24 1119: Access of possibly undefined property _xmouse through a reference with static type flash.display:DisplayObject. Scene 3, Layer 'AS', Frame 1, Line 24
1119: Access of possibly undefined property _xmouse through a reference with static type flash.display:DisplayObject.**

the code is:

 enter code here
    root.onEnterFrame = function() {
    if(root._ymouse<601){
        myVar=false;
    }
    if(root._ymouse>600){
        myVar=true;
    }
    if(root._xmouse<100 && myVar==true)
    {
        imgBar.prevFrame();
        imgBar.prevFrame();
        imgBar.prevFrame();
    }
    else{
        imgBar.play;
    }
    if(root._xmouse>600 && myVar==true){
        imgBar.nextFrame();
        imgBar.nextFrame();
    }
    else{
        imgBar.play;
    }
    if(root._xmouse>100 && root._xmouse<600 && myVar==true){
    imgBar.stop();

    }
    }

Upvotes: 0

Views: 500

Answers (1)

Code Whisperer
Code Whisperer

Reputation: 23652

Your code is in AS2. in AS3, objects use the addEventListener property instead of constructs like onEnterFrame.

Change the targeting of your project to AS2, or you can just revise the top line of code like so:

root.addEventListener(Event.ENTER_FRAME, function() {

   ... // your code

 })

Upvotes: 2

Related Questions