Do not understand what is wrong in the code

Task of my code that movieclip on stage, changing its size - height when changing window size of browsers (player) so height movieclip = fenΩtre rowsers (player) of height.

Here's my code:

package
{
import flash.display. *;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

SerializableAttribute public class ZhMenu extends Sprite
{
public var menubg:MovieClip;

public void ZhMenu()
{
var menubg: = new menuGrad();
stage.scaleMode = StageScaleMode.NO_SCALE;
internship. Align = StageAlign.TOP_LEFT;
stage.addEventListener (Event.RESIZE, onResize);
this.addChild (menubg);
menuBG.x = 0;
menuBG.Width = 150;
menuBG.Height = stage.stageHeight;
}


public void onResize (event: Event): void
{
var sh: number = stage.stageHeight;
menuBG.x = 0;
menuBG.Width = 150;
menuBG.Height = SH;
}
}
}

In the number MovieClip menubg added on stage, but when I change the size of the window I have error:

TypeError: Error #1009: it is not possible to cause a property or a method by referring to the object "null."
to ZhMenu / onResize)

And menubg do not change size of course.

I don't understand what the problem is.

Plize help me if you know Action Script 3.0 better.

I don't know if this will fix the error, but in the function ZhMenu, you declare another object in mwnubg (var menubg: = new menuGrad();), which will have no scope within this function.  That you declare (public var menubg:MovieClip ;) outside is never instantiated, and is the one who tries to change your function onResize.)

As far as the error goes, go to your publication of Flash settings and select the option to enable debugging.  When you run the file again, there may be a number provided in the error message indicating which line is causing the problem.

Tags: Adobe Animate

Similar Questions

  • I want to download all versions are necessary, but I can not understand what are the dated versions are currently installed in my PC?

    Re: "drivers and downloads" my computer dell laptop inspiron I6400 / E 1505; Windows vista Home premium, 32 bit OS: I want to download all versions are necessary, but I can not understand what are the dated versions are currently installed in my PC?

    Hello

    I suggest you try the given below steps that would help you to view the details of the driver.

    (a) type devmgmt.msc into the search box start and press enter.

    (b) in the Device Manager, right click on the device you need to display the version.

    (c) select Properties.

    (d) click the driver tab and display the version of the driver in the Driver Details.

    Hope this information is useful.

  • When I click on a tile (windows8.i) screen just flicks and the program does not open what went wrong and can I fix it?

    * Original title: opening with a tile on the start menu

    When I click on a tile (windows8.i) screen just flicks and the program does not open what went wrong and can I fix it?

    (Moved to customization and ease of access)

    I thought I made the text in a link from my mistake. Here is the page: solve the problems with an app

  • Hello. I do not understand what that error for Adobe Illustrator and Adobe Muse creative cloud products: I open the app and they are closed today. In the writing of Muse: app error #1009 in Illustrator just closed.

    Hello. I do not understand what that error for Adobe Illustrator and Adobe Muse creative cloud products: I open the app and they are closed today. In the writing of Muse: app error #1009 in Illustrator just closed.

    Please check:

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    Adobe Flash Player Error #1009 Windows 8.1

    TypeError: Error #1009

    Flash Player ' TypeError: Error #1009: cannot access one - Microsoft Community

    It seems to be an error in the Flash Player rather than illustrator.

    Concerning

    Stéphane

  • I do not understand what the function of the Pseudo-classes

    I do not understand what the function of the CSS Pseudo-classes 'top', 'right', 'bottom' and 'left' in a tab pane.

    Could someone explain to me? Can you give me an example?

    Another thing... How to center the tabs in a tab pane?

    In advance thank you very much to all

    I do not understand what the function of the CSS Pseudo-classes 'top', 'right', 'bottom' and 'left' in a tab pane.

    They are related to the side property.
    http://docs.Oracle.com/JavaFX/2/API/JavaFX/scene/control/TabPane.html#sideProperty
    The property side is where the tabs are placed with respect to the visible tab pane.

    If you do not use this property, you don't need to worry their about to much.
    The default value for the side is high, as the pseudo-class flaw that will be active.

    Another thing... How to center the tabs in a tab pane?

    Ask a separate question.

  • I have Windows XP Professional with version 5.1 of windows and told me that I have to upgrade, but I do not understand what I do, can someone help me?

    I have a laptop Lenovo who was my daughters. I use it very well, but I can't figure out how to get Outlook Express on it as if I had on my old office. So, I was looking for how to do that I have seen that this version of Windows XP Professional SP3 won't be supported by Microsoft and should be updated but I do not understand what it is or what I need to do. It says I need to download the risk mitigation: Why stick with XP is a bad idea, but I'm afraid that download because I don't know what this means.  Can someone please help me understand what I need to do so that I can use this computer to keep in touch with my daughter and son through Outlook Express electronic mail?

    You don't need to upgrade. XP SP3 will be supported until April 2014. After that, there will be no more patches or updates, but work remains. There are still a lot of Win98 users out there.

  • When I click on any icon in my control panel, a black window opens and C:WINDOWS\system32\rundll32.exe is what's wrong with the system

    When I click on any icon in my control panel, a black window opens and C:WINDOWS\system32\rundll32.exe is what's wrong with the system

    {Assuming the rundll32.exe file is not found}

    See if them can restore the file rundll32.exe:
    http://support.Microsoft.com/kb/812340 Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]

  • attempt to send e-mail 1. They asked to add characters to avoid spam, do not understand what characters and where are they going? Thank you

    Hi, try to send a 1 direct e-mail. they ask to add characters before sending to avoid threats, but do not understand what characters and where are they going? Thank you and God bless you

    Hello

    I'm sorry, but we cannot help with hotmail problems in these forums in response to vista

    Please repost your question in hotmail in the hotmail link below forums

    http://windowslivehelp.com/product.aspx?ProductID=1

    Forums
  • Hi, when I create a text box, and I type text in it, then I resize this text box, I want to see inside moving text at the same time I'm re-sizing of the text box. It does show me not LIVE what is happening inside the text box while I'm re-sizing text

    Hi, when I create a text box, and I type text in it, then I resize this text box, I want to see inside moving text at the same time I'm re-sizing of the text box. It does show me not LIVE what is happening inside the text box while I'm re-sizing of the text box and the same goes for the area of the image, I hope I could clarify my question.

    When resizing of a text box, click and hold for a moment before starting to resize. This will allow to see live redesign.

  • Rounded corners code - what is wrong with my code?

    Hello

    I'm trying to use Win DW5 and CSS3 for rounded corners of the boxes (only at the top left and top right rounded - down should be square) in pure CSS3.

    Can someone tell me what is wrong with my code below?  (Top of page code makes 4 corners roudned and background code doesn't appear to upper right corner rounded - and not the left one.

    < div style = "padding: 10px;" Width: 445px; height: 370px; border-radius: 10px; -o-border-radius: 10px; -icab-border-radius: 10px; -khtml-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; background-color: #d1ddf7; border: 1px solid #000; ">

    < / div >

    < p > < / p >

    "< div style =" width: 445px; height: 370px;

    border-radius:

    -webkit-border-top-left-radius: 10px;

    -webkit-border-top-right-radius: 10px;

    -moz-border-radius-topleft: 10px;

    -moz-border-radius-topright: 10px;

    background-color: #d1ddf7; border: 1px solid #000; ">

    < / div >

    "Thx. for any help.

    Jane

    Take a look at this:

    http://www.CSS3.info/preview/rounded-border/

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB
    http://ALT-Web-design.blogspot.com/

  • Installed Sonic RecordNow DELETE. Ste 7.0, but the program says that my readers arwe set to 'off '. They are not. What's wrong?

    Program installed but starts it gives the error that my readers are set to disabled. (DUH!) My drives are NOT set to off. I know that the program is not compatible with Win 7 (element DLA not install), but it is not necessary to start the program.

    So, what's the problem?

    Duplicate thread:

    I have a problem with RecordNow 7.0.

    When I run the program, I get a message that says that my drives are set to disabled. they are not. I had this problem before and resolved, I think, by installing the latest PX engine update. This time, however, that has not worked. Any ideas?

    Hello

    Given that the program is not compatible with the windows operating system 7 install the program in compatibility mode.

    Most programs written for Windows Vista also work in this version of Windows, but some older programs might run poorly or not at all. If a program written for an earlier version of Windows does not work, you can try changing the compatibility of the program settings, either manually or by using the program compatibility problems.

    To run the troubleshooting program compatibility Troubleshooter

    1. open the program compatibility problems by clicking on the Start button, then Control Panel. In the search box, type Troubleshooting, and then click Troubleshooting. Under programs, click run programs made for previous versions of Windows.

    2. follow the instructions in the troubleshooting.

    If you are unable to install a program, insert the installation disc for the program and, using the Troubleshoot utility, navigate to the program setup file, usually called Setup.exe, Install.exe, or something similar. This utility is not designed to work on programs that have an .msi file name extension.

  • Do not understand what that means i/o Error: import the file

    I am building a website in dreamweaver cs5 with an XML doctype. When I tried to validate my css I got an error code that I do not understand. This is the error: IO error: import file:/Volumes/Macintosh%20HD/Users/schweideltyson/Desktop/CS%2080_final%20project/gallery .html: operation not permitted. Any suggestions? The only thing I can think is that I imported a text for my another Web site index page.

    XML is used for data.  It is an example of a selection of media in XML.

    http://XSPF.org/NS/0/">

    file:///MP3s/song_1.MP3

    file:///MP3s/song_2.MP3

    file:///MP3s/song_3.MP3

    XHTML is for web pages.

    http://www.w3schools.com/HTML/html_doctype.asp

    Nancy O.

    ALT-Web Design & Publishing

    Web | Graphics | Print | Media specialists

    http://ALT-Web.com/

    http://Twitter.com/ALTWEB

  • Dragon Naturally Speaking, I installed but it does not run what is wrong?

    Dragon Naturally Speaking, I installed but it will not open or run what is wrong?

    [Moved - Windows 7, IE9]

    Hi patrickquinn35,

    Thank you for writing to Microsoft Communities. The description of your problem, I understand that the Dragon Naturally Speaking application does not work. Before you start the troubleshooting steps, I need the required information:

    ·         He has already worked?

    ·         Did you do changes on the computer before the show?

    ·         You get the error message?

    Follow these methods.

    Method 1: Uninstall and reinstall the application.

    Uninstall or change a program

    Method 2: Perform a clean boot to see if there is a conflict of software like the clean boot helps eliminate software conflicts.

    Note: After completing the steps in the clean boot troubleshooting, follow step 7 the link to start the computer to a Normal startupmode.

    If the problem persists, you can also contact the support of application provider for more help and information.

    http://www.nuance.com/support/index.htm

    Let us know if you need more assistance. We will be happy to help you.

    Thank you.

  • Cannot understand what is wrong in my reversal/deployment menu project

    What I was trying to do, is make similar to menu http://www.jeremylevine.com/

    I was looking around and couldn't find an idea of how it was done, so I tried my way.

    Here's what I did-- http://atlasinvest.me/menu/

    You will notice that in crossing the middle button to one of the other two, it falls smoothly, but then the crossing of side buttons towards the Middle, he plays not the framework which should be the smooth animation part.

    Here's the source http://atlasinvest.me/menu/menu.fla

    I was trying to figure why he isn't playing, as the code is the same for both buttons, but I am obviously missing something.

    Maybe the second pair of eyes to spot something and I would be grateful

    And the other question... is there a less complicated way of what I'm heading towards... in order to make the menu as in the first link above?

    I did another file from scratch and thought that my if / variable else was wrong!

    Instead of

    on the other

    C1.gotoAndPlay ("n - L1");

    C2.gotoAndPlay ("n - L2");

    should be

    else {}

    C1.gotoAndPlay ("n - L1");

    C2.gotoAndPlay ("n - L2");

    }

    And it works!

    Thanks for help once more.

    Edit: I have reuploaded swf in the link so you can see how it works now.

  • How to understand what number I in the variable?

    Hello.

    I create game related stuff. If icon 1 == 2 icon can I remove this icons. Player to finish the game when it matches all the icons.

    I try give points for correct unswers. And try to calculate this visit.

    Code:

    package 
    {
         import flash.display.MovieClip;
         import flash.events.MouseEvent;
         import flash.text.TextField;
    
    
         public class MyMatching extends MovieClip
         {
              public var play_btn:MyButton = new MyButton();//creating new object play_btn
              public var xIconsContainer=100;//all icons start to draw from this x
              public var yIconsContainer=100;//all icons start to draw from this y
              
              private var iconsVertical=2;//icons columns
              private var iconsHorizontal=2;//icons rows
              
              private var firstIcon;//player click to first icon
              private var secondIcon;//player click to second icon
              
              private var deletedIcons;//if firstIcon==secondIcon we will delete 2 icons
              
              private var myTimer:MyTimer;
              //private var myScore:MyScore;
              
              private var playerScoreSum:int;
              private var playerScorePreview:TextField; 
              
              //constructor
              public function MyMatching():void
              {
                   welcomeScreen();
                   deletedIcons = 0;
                   playerScoreSum = 0;
              }
              
              public function welcomeScreen():void
              {
                   gotoAndStop('WelcomeScreen');
                   play_btn.x=210;
                   play_btn.y=300;
                   play_btn.visible=true;
                   addChild(play_btn);//draw play_btn object
                   play_btn.addEventListener(MouseEvent.CLICK, goToLevel_1);//added event for the play_btn object
              }
              
              public function goToLevel_1(event:MouseEvent)
              {
                   play_btn.visible=false;
                   gotoAndStop('Level_1');
                   
                   var iconsArray:Array = new Array();//creating new object iconsArray
                   for (var i:int; i < iconsVertical*iconsHorizontal/2; i++)
                   {
                        iconsArray.push(i);
                        iconsArray.push(i);
                   }
                   trace(iconsArray);
                   
                   //added timer to the screen
                   myTimer = new MyTimer();
                   addChild(myTimer);
                   
                   //added score to the sceen
                   playerScorePreview = new TextField();
                   playerScorePreview.text = String(playerScoreSum);
                   playerScorePreview.x=200;
                   playerScorePreview.y=0;
                   addChild(playerScorePreview);
                   
                   for (var x:int = 0; x < iconsVertical; x++)
                   {
                        for (var y:int = 0; y < iconsHorizontal; y++)
                        {
                             var iconsList:Icon = new Icon();
                             addChild(iconsList);
                             iconsList.stop();
                             iconsList.x=x*51+xIconsContainer;
                             iconsList.y=y*51+yIconsContainer;
                             var myRandom:int=Math.floor(Math.random()*iconsArray.length);//creates a random number that will be related to an index of the array named "iconsArray"
                             //var showIcon;//cast as whatever type of element the array is holding
                             iconsList.showIcon=iconsArray[myRandom];//assigns the randomly selected element of iconsArray to the variable showIcon
                             iconsArray.splice(myRandom,1);//removes the randomly selected element (now showIcon) from the array (not the last one, the random one) //we use the splice command to remove number from the array so that it won’t be used again
                             //iconsList.gotoAndStop(iconsList.showIcon+2);//showIcon+2 would be the next frame in the timeline after the frame for the random item deleted, so that code is essentially moving in the timeline to the frame just after the frame for the item that was removed from the array
                             trace(myRandom);
                             iconsList.addEventListener(MouseEvent.CLICK, clickToIcon);
                             deletedIcons++;//when we draw icons we every time add +2 icons to our deletedIcons variable, in future we will deleted 2 icons from this variable if firstIcon==secondIcon
                        }
                   }
                   trace("*************************random finished ******************************");
              }
              
              public function clickToIcon(event:MouseEvent)
              {
                   var thisIcon:Icon = (event.currentTarget as Icon);//what icon player clicked...
                   trace(thisIcon.showIcon);//trace clicked icon to the output pannel
                   if (firstIcon==null)
                   {
                        firstIcon=thisIcon;
                        firstIcon.gotoAndStop(thisIcon.showIcon + 2);
                   } 
                   else if (firstIcon == thisIcon)
                   {
                        firstIcon.gotoAndStop(1);
                        firstIcon=null;
                   } 
                   else if (secondIcon==null)
                   {
                        secondIcon=thisIcon;
                        secondIcon.gotoAndStop(thisIcon.showIcon + 2);
                        
                        playerScoreSum -= playerScoreSum;// -1 point for playerScoreSum
                        
                        if (firstIcon.showIcon==secondIcon.showIcon)
                        {
                             playerScoreSum += 20;// +20 points for playerScoreSum
                             playerScorePreview.text = String(playerScoreSum);
                             
                             removeChild(firstIcon);
                             removeChild(secondIcon);
                             deletedIcons -= 2;
                             if (deletedIcons == 0)
                             {
                                  myTimer.Stop();//stoping timer, so now we know how time player spend to playing the level 1
                                  //playerScorePreview.text = String(playerScoreSum);//stoping  and show player score
                                  gotoAndStop('GameoverScreen');//if player match all icons we go to GameoverScreen                              
                             }
                        }
                   }
                   else
                   {
                        firstIcon.gotoAndStop(1);
                        secondIcon.gotoAndStop(1);
                        firstIcon = null;
                        secondIcon = null;
                   }
              }
         }
    
    }
    

    So, in class, I added 2 variables:

    private var playerScoreSum:int;
    private var playerScorePreview:TextField;
    

    Display the text on the screen and recreate the type:

    //added score to the sceen
    playerScorePreview = new TextField();
    playerScorePreview.text = String(playerScoreSum);
    playerScorePreview.x=200;
    playerScorePreview.y=0;
    addChild(playerScorePreview);
    

    If icon1 is icons2:

    if (firstIcon.showIcon==secondIcon.showIcon)
                        {
                             playerScoreSum += 20;// +20 points for playerScoreSum
                             playerScorePreview.text = String(playerScoreSum);
                             
                             removeChild(firstIcon);
                             removeChild(secondIcon);
                             deletedIcons -= 2;
                             if (deletedIcons == 0)
                             {
                                  myTimer.Stop();//stoping timer, so now we know how time player spend to playing the level 1
                                  //playerScorePreview.text = String(playerScoreSum);//stoping  and show player score
                                  gotoAndStop('GameoverScreen');//if player match all icons we go to GameoverScreen                              
                             }
                        }
    

    Now I see 0 to start the game.

    20 when I mutching 2 icons

    20 when I mutching still 2icons (but must be 40)

    I don't understand why I don't have 40.

    I tried debugger IDE Flash, but can't understand how all of them work. : () I thought that I must go into the code as compiler go... to a line of code to the other + must see my game + must see changes made to variables...

    Then issue:

    Why can't you culculate?

    And can you suggest what debuger need to use as3 code? (I've used FlashDevelop to write code and I find the tutorial on the use of a debugger, but not everything can have :())

    Your problem is probably in the following line:

    playerScoreSum = playerScoreSum; / / - 1 point for playerScoreSum

    Which is set to zero the playerScoreSum just before that your code can add 20 to it.

Maybe you are looking for