I have an access of undefined property _root. and access to property may be undefined

I have 2 errors with my script (below) it is assumed to be Actionscript 3.0.

I'm getting a

1120: access of undefined property _root.

and has...

1119: access of property may be undefined onRelease through a reference with static type flash.display:SimpleButton.

Here is my code...

var frameNum:Number

function photoChange() {}

_root.photos.gotoAndStop ("img" + frameNum);

}

{btn1.onRelease = Function ()}

frameNum = 1

photoChange();

}

{btn2.onRelease = Function ()}

frameNum = 2

photoChange();

}

{btn3.onRelease = Function ()}

frameNum = 3

photoChange();

}

{btn4.onRelease = Function ()}

frameNum = 4

photoChange();

}

{btn5.onRelease = Function ()}

frameNum = 5

photoChange();

}

{btn6.onRelease = Function ()}

frameNum = 6

photoChange();

}

{btn7.onRelease = Function ()}

frameNum = 7

photoChange();

}

{btn8.onRelease = Function ()}

frameNum = 8

photoChange();

}

{btn9.onRelease = Function ()}

frameNum = 9

photoChange();

}

{btn10.onRelease = Function ()}

frameNum = 10

photoChange();

}

{btn11.onRelease = Function ()}

frameNum = 11

photoChange();

}

{btn12.onRelease = Function ()}

frameNum = 12

photoChange();

}

Could someone help me please!

_root and onRelease are not AS3, AS2 code to which they belong.  Basically, all of the code that you show treat like AS2, but will have made a mistake if you have your publication set for AS3 settings.  To implement it in AS3 code, you must follow the changes indicated below for all of the code...

var frameNum:Number;

function photoChange(evt:MouseEvent) {}

frameNum = Number (String (evt.currentTarget.name) .substr (3))
photos.gotoAndStop ("img" + String (frameNum));

}

Btn1.addEventListener (MouseEvent.CLICK, photoChange);

.

etc.

.
btn12.addEventListener (MouseEvent.CLICK, photoChange);

Assuming you are using the button symbols, the function by using string manipulations to get the chassis number of the button name.  If you use MovieClips as buttons you can assign each number as a property and get this quite the contrary.  Buttons do not support the dynamic properties as do MovieClips.

The reference to _root in AS3 is simply 'root' but which has usually need a qualifier, as in MovieClip (root).  In many cases using a root reference is not necessary.  If your code is on the main timeline, then there is no need to use references from the root because it is essentially where you are already.  If this code is inside another object on the timeline, then using... MovieClip (root). photos.gotoAndStop... etc would be a solution.

Tags: Adobe Animate

Similar Questions

  • 1119: access of property may be undefined with currentFrameLabel through a reference with static type f

    1119: access of property may be undefined with currentFrameLabel through a reference with static type flash.display:DisplayObject.

    line with the error: if (holder.getChildAt (i).currentFrameLabel.search ("false")! = - 1) {}

    any help?

    Try:

    If (MovieClip (holder.getChildAt (i)).currentFrameLabel.search ("false")! = - 1)

  • addEventListener leads to 1119: access to property may be undefined "myEvent" through a reference with static type class

    I use a main application mxml and a component

    I said a metatag in the component

    [Event(name ="myEvent"type ="events.myEvent")]

    I have this hurry of the component

    I have a listener on the main application

    componentid.addEventListener (Event.MyEvent, gotoMyFunction, true);

    I get a compile error, no matter what I do

    1119: access of property may not set through a reference with static type class

    Any ideas. I had at least 3 examples and in all cases I end up with the same result

    Put [event (name = "myLoadDoneEvent" type = "events.loadDoneEvent")] before the class declaration:

    public class loadDoneEvent extends event

    [Event (name = "myLoadDoneEvent" type = "events.loadDoneEvent")]

    If this post answers your question or assistance, please mark it as such.

  • Error 1119: Access of a property may not set with a keyboard event

    Scene 1, Layer 'layer 1', frame 1, line 5.1119: access of property may be undefined LEFT through a reference with static type class.
    Scene 1, Layer 'layer 1', frame 1, line 6.1119: access of property may not set down through a reference with static type class.
    Scene 1, Layer 'layer 1', frame 1, line 7.1119: access of possibly undefined property BACK through a reference with static type class.
    Scene 1, Layer 'layer 1', frame 1, line 8.1119: access of property may not set through a reference with static type class.

    I think that to have public but do not know how the value Keyboard.Event.LEFT, UP, DOWN, RIGHT.

    import flash.events.KeyboardEvent;

    stage.addEventListener (KeyboardEvent.LEFT, characterMove);

    stage.addEventListener (KeyboardEvent.DOWN, characterMove); ------Headphones of events for left keyboard etc.

    stage.addEventListener (KeyboardEvent.UP, characterMove);

    stage.addEventListener (KeyboardEvent.RIGHT, characterMove);

    new audience; function characterMove(evt:KeyboardEvent):void {------function to move the person}

    Switch (evt.keyCode) {}

    case Keyboard.LEFT:

    Person.x-= 20;

    case Keyboard.RIGHT:

    Person.x += 20;

    case Keyboard.DOWN:

    Person.y-= 20;

    case Keyboard.UP:

    Person.y += 20;

    by default:

    trace ("keyboard event error")

    }

    }

    Your listeners must specify KeyboardEvents and upward, DOWN, LEFT, RIGHT aren't KeyboardEvents, they are key keyboard codes.  Using KEY_UP and KEY_DOWN instead of each of them in the headphones.

  • How to have full access to Windows

    How to have all access to this window?
    When I bought it with the money, then it must be mine property, so! Why don't I have full access to all his files and all services?
    If this is possible (maybe I don't know on this subject) please please send me details if I change in the local policy or any other MSC...!

    Hi rahuldhiman, I have shared your question in a new conversation because she was not related to the previous topic.

    Already, you have full access to your computer, if you have configured your administrator account.  This means that you can access all files on the computer, even the files that belong to other users.  You can also change the passwords of other users and other administrative powers.  It's like 'root' on a unix system.

    Please note, however, that even administrators could occasionally see "access denied" messages. There are legitimate reasons for it. For example:

    1. Junction Points
      they look like folders, smells like records and even could be files in previous versions, but they are not really files.  For example, there is no folder named "Documents and Settings" on Windows 7.  The "Users" folder takes the place of it.  But for compatibility, a junction was created with the name "Documents and Settings".  So if you have enabled the display of hidden and protected from the operating system files, you may see this fake file. If you try to access it, you will get "access denied".  Not because you are limited, but because no folder actually exists.
    2. Safety and least privilege user / User Account Control
      It is dangerous to always have administrator privileges, because any virus or malicious software which can run (or you cheat in the race), would immediately have total control over your computer. Instant infection.  Which is not good, so your ability to modify the system files (such as C:\Windows\System32) is automatically reduced.  Yes, you can still "own" and "change security" so that you can edit these files (because you are the administrator, you can do anything), just because you CAN does not mean you LIKE it.  If you do so, your data and computer security would be at risk.
  • 1119: access of width property may not set through a

    Lock layer 'Action', frame 80, line 271119: access of width property may not set through a reference with static type flash.media:Sound.

    So I get this error message on the three images that worked until I walked into some code which I think is shake it. Basically, this framework includes miniature pictures and when you click on them, they expand. That's what all the code at the bottom. The code that causes the problem I believe is that I added that was:

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    I have added this code, because on the frame, the user has the possibility to listen to the slide if they click on the audio button. I had a problem in which the frame did not run with a command simple channel17l.stop , because that only works if the user has clicked on the audio button, which is not necessary.

    Here is my code with the bold error codes. I think that the addition of the If (channel14L! = null) what the hell. Need help!

    import flash.events.MouseEvent;

    import flash.media.SoundChannel;

    Stop();

    emer_cont_btn14l.enabled = true;

    emer_exit_btn14l.enabled = true;

    emer_help_btn14l.enabled = true;

    emer_glossary_btn14l.enabled = true;

    emer_mm_btn14l.enabled = true;

    emer_btn14l.enabled = true;

    fire_btn14l.enabled = true;

    lock_btn14l.enabled = true;

    audio_btn14l.enabled = true;

    var lockclass01:Sound = new LockClass01();

    var channel14L:SoundChannel;

    audio_btn14l.addEventListener (MouseEvent.CLICK, Audio14l);

    function Audio14l(event:MouseEvent):void

    {

    channel14L = lockclass01.play ();

    }

    emer_cont_btn14l.addEventListener (MouseEvent.CLICK, Lock14l);

    function Lock14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop("17L");

    }

    emer_btn14l.addEventListener (MouseEvent.CLICK, Emer14l);

    function Emer14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop ("1st", "Emer");

    }

    fire_btn14l.addEventListener (MouseEvent.CLICK, Firebtn14l);

    function Firebtn14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop ("1F", "Fire");

    }

    lock_btn14l.addEventListener (MouseEvent.CLICK, Lockbtn14l);

    function Lockbtn14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop("1L","Lock");

    }

    emer_exit_btn14l.addEventListener (MouseEvent.CLICK, Scene14l);

    function Scene14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop ("one", "Scene2");

    }

    emer_mm_btn14l.addEventListener (MouseEvent.CLICK, MainMenu14l);

    function MainMenu14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop ("2MM", "MainMenu");

    }

    emer_help_btn14l.addEventListener (MouseEvent.CLICK, Help14l);

    function Help14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop ("oneb", "Help");

    }

    emer_glossary_btn14l.addEventListener (MouseEvent.CLICK, Glossary14l);

    function Glossary14l(event:MouseEvent):void

    {

    If (channel14L! = null) {}

    channel14L.stop ();

    }

    gotoAndStop ("onec", "Glossary");

    }

    lockclass01.addEventListener (MouseEvent.CLICK, biglockclass01);

    var lockclass01Size = "small";

    var lockclass01Width = lockclass01.width;

    var lockclass01Height = lockclass01.height;

    var lockclass01X = lockclass01.x;

    var lockclass01Y = lockclass01.y;

    function biglockclass01(event:MouseEvent):void

    {

    If (lockclass01Size == 'small') {}

    lockclass01Size = "large";

    lockclass01.width = 288.25;

    lockclass01. Height = 384.35.

    lockclass01.x = 212.35;

    lockclass01.y = 45.20;

    } else {}

    lockclass01Size = "small";

    lockclass01. Width = lockclass01Width;

    lockclass01. Height = lockclass01Height;

    lockclass01.x = lockclass01X;

    lockclass01.y = lockclass01Y;

    }

    }

    lockclass02.addEventListener (MouseEvent.CLICK, biglockclass02);

    var lockclass02Size = "small";

    var lockclass02Width = lockclass02.width;

    var lockclass02Height = lockclass02.height;

    var lockclass02X = lockclass02.x;

    var lockclass02Y = lockclass02.y;

    function biglockclass02(event:MouseEvent):void

    {

    If (lockclass02Size == 'small') {}

    lockclass02Size = "large";

    lockclass02. Width = 288.25.

    lockclass02. Height = 384.35.

    lockclass02.x = 212.35;

    lockclass02.y = 45.20;

    } else {}

    lockclass02Size = "small";

    lockclass02. Width = lockclass02Width;

    lockclass02. Height = lockclass02Height;

    lockclass02.x = lockclass02X;

    lockclass02.y = lockclass02Y;

    }

    }

    lockclass03.addEventListener (MouseEvent.CLICK, biglockclass03);

    var lockclass03Size = "small";

    var lockclass03Width = lockclass03.width;

    var lockclass03Height = lockclass03.height;

    var lockclass03X = lockclass03.x;

    var lockclass03Y = lockclass03.y;

    function biglockclass03(event:MouseEvent):void

    {

    If (lockclass03Size == 'small') {}

    lockclass03Size = "large";

    lockclass03. Width = 288.25.

    lockclass03. Height = 384.35.

    lockclass03.x = 212.35;

    lockclass03.y = 45.20;

    } else {}

    lockclass03Size = "small";

    lockclass03. Width = lockclass03Width;

    lockclass03. Height = lockclass03Height;

    lockclass03.x = lockclass03X;

    lockclass03.y = lockclass03Y;

    }

    }

    lockclass04.addEventListener (MouseEvent.CLICK, biglockclass04);

    var lockclass04Size = "small";

    var lockclass04Width = lockclass04.width;

    var lockclass04Height = lockclass04.height;

    var lockclass04X = lockclass04.x;

    var lockclass04Y = lockclass04.y;

    function biglockclass04(event:MouseEvent):void

    {

    If (lockclass04Size == 'small') {}

    lockclass04Size = "large";

    lockclass04. Width = 288.25.

    lockclass04. Height = 384.35.

    lockclass04.x = 212.35;

    lockclass04.y = 45.20;

    } else {}

    lockclass04Size = "small";

    lockclass04. Width = lockclass04Width;

    lockclass04. Height = lockclass04Height;

    lockclass04.x = lockclass04X;

    lockclass04.y = lockclass04Y;

    }

    }

    Thank you!

    Your problem starts at the line...

    var lockclass01:Sound = new LockClass01();

    You set as a sound object.  But then, you try to treat it as if it was a display of form obf object and try to access properties that are reelated to display objects such as width, height, x, y

    var lockclass01Width = lockclass01.width;

    var lockclass01Height = lockclass01.height;

    var lockclass01X = lockclass01.x;

    var lockclass01Y = lockclass01.y;

    function biglockclass01(event:MouseEvent):void

    {

    If (lockclass01Size == 'small') {}

    lockclass01Size = "large";

    lockclass01.width = 288.25;

    lockclass01. Height = 384.35.

    lockclass01.x = 212.35;

    lockclass01.y = 45.20;

    } else {}

    lockclass01Size = "small";

    lockclass01. Width = lockclass01Width;

    lockclass01. Height = lockclass01Height;

    lockclass01.x = lockclass01X;

    lockclass01.y = lockclass01Y;

    Then you probably need to get rid to declare it as a sound object if there isa not.

  • property may be undefined by reference to static type flash.

    Hi guys, well I created a slide show. Only problem is that I keep getting error messages that say "property may not defined by reference to the static type flash.", or they say 'access of undefined property...'

    I've done a lot of research, and my situation does not change if I use Action Script 2 or 3. In the example of his three. I did the numeric keys that are supposed to make to cover the slide show. I would really appreciate any suggestions.
    You can see the slideshow here:

    http://Paragon-NJ.com/slideshow.html

    and the FLA:

    http://Paragon-NJ.com/slideshow.fla


    Currently I use this code with one, two and three being the butttons:

    {one.onRelease = function ()}
    gotoAndPlay (90);
    }

    {two.onRelease = function ()}
    gotoAndPlay (175);
    }

    {three.onRelease = function ()}
    gotoAndPlay (260);
    }

    If you publish a swf file with actionscript 2 with this code and nothing else, you generate no error messages.

  • How can I put someone other iCloud for my computer account? I'm on my mothers iPhone account and I don't have physical access to its features, nor can I explain to heehaw to do itself.

    How can I put someone elses iCloud account from my computer? I'm on my mothers iPhone account and I do not have physical access to its features nor can I explain how do it herself.

    No, but you can use a remote control program and do it yourself. Try Teamviewer, or similar.

  • I need the Java Player for firefox on a stand-alone computer without internet access. I have internet access on another computer. How can I do this?

    I have a stand-alone computer (no internet access) with firefox to run the Java Player. I have internet access on another computer in order to download files and hover over things to the stand-alone computer to install. That do and where can I download and how I install on the stand-alone computer.

    Thank you

    Leroy

    Hi, to get the Offline Installer that you can use on the computer without internet access, please visit https://java.com/en/download/help/windows_offline_download.xml

  • I wish I could make a website I use ofter and drop it on the screen of firefox under url. Then, I'll have rapid access. How can I do this?

    Question
    I wish I could make a website I use ofter and drop it on the screen of firefox under url. Then, I'll have rapid access. How can I do this? I currently use it on my laptop, but recently bought a new computer and downloaded firefox and lost a lot of features that I enjoyed.

    It was exactly what I was looking for - thanks a lot!

  • I have my Android phone in sync with my desktop PC and I want to sync a new laptop, but I have no access to my PC original desktop, but only for the Android phone

    Firefox has been installed in my desktop PC. Then I bought an Android phone, and I've synced it to my computer.
    Now I have no access to my PC and I bought a laptop that I want to also synchronize, but the only device available to do the sync is my Android phone and I don't see how I can do the sync

    This add-on for Firefox mobile will allow you to view your sync key: https://addons.mozilla.org/en-US/mobile/addon/aboutsynckey/

  • I have and iPhone 4S that I am trying to activate and he was released at factory and when I turn on it his need I sign in an old Apple ID that I have more access to email. It is eliminated.

    I have and iPhone 4S that I am trying to activate and he was released at factory and when I turn on it his need I sign in an old Apple ID that I have more access to email. It is eliminated.

    Unfortunately, it seems that the device is always related to your iCloud account, which makes the useless device for you to use unless unlock you by entering the password. My only recommendation would be to reset your apple id password. You can do this by answering the security questions, you must Access your e-mail in order to.

    Reset your password here:

    https://iforgot.Apple.com/

    I hope this helps!

  • access of the lost messages "sent" it is essential that I have again access to my messages as history affects future communications about a foreign nation

    Lost access "sent messages".

    It is essential that I have again access to my 'sent messages' as history impacts futuire communicatio about events in a foreign country. I have Hotmail through Qwest Communications.

    Since you are using Hotmail, you will need to repost your question in forum Windows Live Hotmail listed below that.
     http://windowslivehelp.com/product.aspx?ProductID=1

    In general, for help on Hotmail/Windows Live products please visit Windows Live Solution Center:
    http://www.windowslivehelp.com/

    Sincerely,

    Marilyn

  • Why some items in 'Open an existing project' have just the name of the project and others have access to the entire file path?

    I have SP1 2012 LabVIEW and on the main screne of LabVIEW selecrt "show projects".

    Why some elements of 'Existing Open' (project) have just the name of the project and others have access to the entire file path?

    Examples of two lines in the list of projects.

    Ping.lvproj (with a path: C:\Users\mlevine\Documents\MPCE EQT\EQT Software\Ping.lvproj)

    C:\Users\mlevine\Documents\Common package Mission trainer (CMPT) \SUW Surface Warfare\Weapon permission Panel (WAP) \WAP LabVIEW Software\WAP fire authorization server 28 April 2015

    No chance, it's because I made a copy of this software and stored on a network drive power off and it went out of this network drive?

    So if LabVIEW sees two or more versions of the same software, he decides to use the name to differentiate between full path?

    I'd still rather it shows just the name of the project and if you hover over the name it shows the full path.

    Thank you

    Mark

    If you have opened a project of the same name from a different location, it is when it shows the full path both - in this case showing just the name of the project would not help because it would be the same thing!

  • You do not have sufficient access to your computer to connect to the selected printer

    I am a beginner to the field. I have recently installed windows 2008 standard edition and create a user and the user even working in the environment field. How can I installed printers installed on the servers. Whenever I click on any printer share the error comes from "you don't have sufficient access to your computer to connect to the selected printer. Client computers is teacher of Win Xp (Sp3) and the printer Kyocera FS - 1030D. Please go back. Waiting for your answer.

    Hi Shiju_Ganga,

    Your Windows 2008 server question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the TechNet Windows server forum.

    http://social.technet.Microsoft.com/forums/en/winserverprint/threads

Maybe you are looking for

  • Why the iPad Mini 4 costs the same as the iPad 2 air?

    I would buy a new iPad, but I don't know which one to buy: iPad 9.7 "iPad Mini 4 and iPad Pro 2 air. It is between the Air 2 and 4 Mini, but I still don't understand why the same cost. Can someone answer this question for which I have looked everywhe

  • light the fire

    How to connect with my kindle to my wireless printer in a single 5312?

  • Name of the device changed but always communicate with the same device

    Hello! I have two 6501 NIDAQs that I use in two different test of PRINTED circuit board equipment. I gave them names 'Dev1' and 'Dev2.  For some reason they cannot not be plugged into the same computer at the same time (USB), given that my TestStand/

  • I have "unusable material devices." They have to do with the WIFI of ideas out there? .... Drgnphli

    When running a diagnostic test to see if everything is ok with my computer. Under inoperable devices were: adapter mini port MS Virtual WIFI and Miniport Wan WAN IKE V2 Code 31.  In fact, both are Code 31. I have a wireless router that works very wel

  • Block certain websites

    Hello Is it possible to block certain websites (ex: myspace.com, friendster.com etc.) using ASA 5510. I know you can use a regex to do this, but I'm not sure on the exact commands. Help, please. Thank you.