Problems with addChild()

Hello

I learn just AS3 and have a problem with addChild(). I created a slide show class, which works fine when I call the document class field of the. Fla. If I call the class slideshow not directly from the FLA, but if another class the slide does not show, even through the slide show is running in the background that I tested with traces.

I'd be happy if someone could help me with this problem.

Thanks in advande

Didi

No, I mean you can not simply use addChild() and expect that something will be added to the display list, UNLESS the addChild() statement was made as part of a display object.

and I doubt that you are part of a display object. You can test that by using trace (container.root) after your declaration of addChild (container) and see if you get the main timeline. are you?

Tags: Adobe Animate

Similar Questions

  • problems with addChild() and removeChild()

    I have the following code:

    Import fl.controls.Slider;

    Import fl.events.SliderEvent;

    import flash.events.MouseEvent;

    import flash.display. *;

    import flash.events. *;

    import flash.net.URLRequest;

    Stop();

    var depthObjects:int = 0;

    setChildIndex (myPush_btn, depthObjects);

    setChildIndex (myUndo_btn, depthObjects + 1);

    setChildIndex (mySlider, depthObjects + 2);

    setChildIndex (preText1, depthObjects + 3);

    setChildIndex (feedBackTxt, depthObjects + 4);

    var contentLoader = new Loader();

    addChildAt (contentLoader, depthObjects + 5);

    var depthObjectsNew:int = depthObjects + 5;

    contentLoader.x =-100;

    contentLoader.y = 200;

    mySlider.addEventListener (SliderEvent.CHANGE, advanceFrame);

    mySlider.addEventListener (SliderEvent.THUMB_RELEASE, advanceFrame2);

    function loadClip(t:String):void {}

    var myUrl:URLRequest = new URLRequest (t);

    contentLoader.load (myUrl);

    }

    var clipString:String = "FILENAME/FILEPATH;

    var clipSuffix:String = '.png ';

    var l10:String = '0000 ';

    var l100:String = "000";

    var l1000:String = "00";

    var l10000:String = '0 ';

    function advanceFrame(e:SliderEvent):void {}

    var framenum = e.value;

    if (framenum < 10) {}

    var tempString = clipString + l10 + framenum, clipSuffix;

    loadClip (tempString.toString ());

    }

    if (framenum > = 10 & & framenum < 100) {}

    tempString = clipString + l100 + framenum, clipSuffix;

    loadClip (tempString.toString ());

    }

    if (framenum > = 100 & & framenum < 1000) {}

    tempString = clipString + l1000 + framenum, clipSuffix;

    loadClip (tempString.toString ());

    }

    if (framenum > = 1000 & & < 1033 framenum) {}

    tempString = clipString + l10000 + framenum, clipSuffix;

    loadClip (tempString.toString ());

    }

    }

    var depth: int = depthObjectsNew;

    function advanceFrame2(e:SliderEvent):void {}

    var framenum = e.value;

    if (framenum < 10) {}

    var tempString = clipString + l10 + framenum, clipSuffix;

    }

    if (framenum > = 10 & & framenum < 100) {}

    tempString = clipString + l100 + framenum, clipSuffix;

    }

    if (framenum > = 100 & & framenum < 1000) {}

    tempString = clipString + l1000 + framenum, clipSuffix;

    }

    if (framenum > = 1000 & & < 1033 framenum) {}

    tempString = clipString + l10000 + framenum, clipSuffix;

    }

    var move: int = 1050;

    var contentLoader2 = new Loader();

    contentLoader2.x = 50;

    contentLoader2.y = 50;

    contentLoader2.scaleX = 7;

    contentLoader2.scaleY = 7;

    myPush_btn.addEventListener (MouseEvent.MOUSE_DOWN, pushArray2);

    myUndo_btn.addEventListener (MouseEvent.MOUSE_DOWN, undoArray2);

    function pushArray2(f:MouseEvent):void {}

    var myUrl:URLRequest = new URLRequest (tempString);

    contentLoader2.load (myUrl);

    addChild (contentLoader2);

    contentLoader2.name = "contentLoader2" + depth;

    setChildIndex (contentLoader2, depth);

    depth ++;

    travel = travel-175;

    contentLoader2.x = displacement;

    feedBackTxt.text = tempString;

    trace (contentLoader2.name);

    }

    var depth2:int;

    stabilise2 = depth-1;

    function undoArray2(g:MouseEvent):void {}

    trace(depth2+"--depth2");

    removeChild ((contentLoader2));

    = 1 depth2 depth2;

    trace (getChildIndex (contentLoader2) + ""-depth of contentLoader2 ' ");

    trace(depth2+"--DEPTH2");

    travel = travel + 175;

    contentLoader2.x = displacement;

    feedBackTxt.text = tempString;

    }

    }

    ///////////////
    I'm setting the depths of rare items on stage from the beginning and trying to addChildren at the specified depth.  If I do not do so in the order, I get an error limits output.  However, I always get the error limits output when I try removeChildren at the specified depth.  And when I try to add new 'old' children that do not persist and are back on the scene.  Everything is somehow tweaked with my code and it is easy to see that I'm not experienced in advanced coding.
    On the one hand I nested functions instead of return values for functions and their transmission to the functions.  I know it's a bad habit, even if I can't find a way to do it without nesting of functions.
    Can someone help me with this situation?
    Basically, I have a bunch of images I am cycling through a zipper and when I get to the image I want I click on a button to add it to the scene permanently (temporarily) and if I make a mistake I have a second button which is supposed to provide the 'undo' to the last child that was added.  If I added several children, several clicks on the Undo button are supposed to get rid of children on the stage in order to be able to go back to the cursor and choose the most appropriate image.  The images are letters that are supposed to clearly indicate the name of a person.  They are rendered images so the graphics are supposed to look unique and scroll through a series of letters in the order between 7 fonts.  I have over 1000 images, because the letters are also be rotated in 3D to a limited extent.  10 or 20 degrees of rotation time 26 times 7 fonts letters gives 1829 images at all. I'm not including glyphs tiny or digital in this setting because some of my drawings of police do not have these glyphs in them.
    Any help on this eve of the new year cold but beautiful is greatly appreciated.
    -markerline

    This code should do what you described.  You should always set your images loaded and do everything with your text:

    var framenum:String;

    mySlider.addEventListener (SliderEvent.CHANGE, thumbSelect);
    mySlider.addEventListener (SliderEvent.THUMB_RELEASE, loadImage);

    var clipPrefix:String = "tagtype_prelim_png_seq/tagtype_prelim_A_001_png_se MMO."
    var clipSuffix:String = '.png ';

    function thumbSelect(e:SliderEvent):void {}
    frameNum = e.value.toString ();
    While (framenum.length<>
    frameNum = '0' + framenum;
    }
    }

    function loadImage(e:SliderEvent):void {}
    var loader: Loader = new Loader();
    Loader.Load (new URLRequest (framenum + clipPrefix + clipSuffix));

    addChild (loader)
    }

    function undo(e:MouseEvent):void {}
    removeChildAt(numChildren-1);
    If there is no next button, which could add these children, their null before removing
    }

  • Problem with addChild()

    HY! I am doing a map for my game and I have a problem that I can't solve. I will not write all the code because it's really big...

    Arena/public class extends MovieClip
    {
    private var logical: ArrayList = new ArrayList();
    private var screen: ArrayList = new ArrayList();

    public void Arena()
    {

    ...

    create logic and Visual elements and add them in the tables

    }

    public function generateMap (): void
    {

    ...

    Add Visual elements (some MovieClips) to their respective places

    }

    public function startListen (): void
    {

    ...

    for (var i: Number = 0; i < 100; i ++)

    display.getItem (j) .getItem (i) .addEventListener (MouseEvent.CLICK, onClick);

    the display is a matrix that is why the getItem is called twice

    Here I am waiting for the user to click on an item and after that to add a data type in the arena at the same place where it was clicked

    }

    function onClick(e:MouseEvent):void

    {

    ...

    var Instance: * = new DataType();
    this.addChild (Instance);

    Instance.x = e.target.x;

    Instance.y = e.target.y;

    the problem is that the e.target.x and there are always 0, no matter what happens.

    If I try to write "e.target.addChild (Instance)" he addes computer where I want, but inside the symbol

    }

    Can someone give me a hand here? Thank you very much!

    Use currentTarget instead of the target.

  • Problem with the PrintJob background and default

    Hello, I have a problem with PrintJob - print in pdf format.

    I want to print bitmaps with transparency and vectors.

    I checked all the options and still have a gray background under the bitmaps and vectors. This is the background color from scene.

    It seems to me that flash is printing in bitmap mode no matter what I do.
    Anyone know how to print MovieClip/Bitmap without default background. I send to print bitmap/movieclip with transparency, but the output is always packed bitmap.

    var pj:PrintJob = new PrintJob();
    var sheets:MovieClip;// = new Sprite();
    var options:PrintJobOptions = new PrintJobOptions();
    options.printAsBitmap = false;
    var dodd:MovieClip = new MovieClip();
    stage.addChild(dodd);
    var pagesToPrint:uint = 0;
    if (pj.start()) {
        for (var i:int = 0; i < pages.length; i++)
        {
            sheets = new MovieClip();
            //sheets.graphics.beginFill(0xFF0000, 0);
            //sheets.graphics.beginBitmapFill(pages[i].getChildAt(0).bitmapData, null, false, true);
            /*sheets.graphics.lineStyle(0,0,0);
            sheets.graphics.drawRect(0, 0, pj.pageWidth, pj.pageHeight);
            sheets.graphics.endFill();*/
            sheets.addChild(pages[i]);
            dodd.addChild(sheets);
            try {
                pj.addPage(sheets, new Rectangle(0, 0, pj.pageWidth, pj.pageHeight) , options);
                pagesToPrint++;
            }
            catch(e:Error) {
                // do nothing
            }
        }
        if(pagesToPrint > 0) {
            pj.send();
        }
       
        while(dodd.numChildren>0){
            dodd.removeChildAt(0);
        }
        stage.removeChild(dodd);
        dodd = null;
       
    }
    
    

    using actionscript, create "pages" with a white background and content you want, and then print these new pages.

  • A little problem with an object

    Hi guys...

    I discovered a problem with an object, but I Don t see where the problem may be...

    I have a 'bomb' added to the step only if the var bomb is greater than or equal to 1... and, of course, if you enjoy it, the var Gets a-... However, after a while, it seems once again

    Any ideas?

    Here is the code bound to it:

    var dynamite: Loader = new Loader();

    Dynamite.Load (new URLRequest ("dynamite.png"));

    Dynamite.x = 650;

    Dynamite.y = - 10;

    var bombsound:Sound = new Sound();

    var bombsoundChannel:SoundChannel = new SoundChannel();

    var bombreq:URLRequest = new URLRequest ("bombexplosion.mp3");

    bombsound. Load (bombreq);

    If (! level) {var level: int = 1 ;}}

    var lvlup:int = 200;

    var updlvl:int = (lvlup * level);

    If (!) (Count) {var count = 0 ;}

    If (! bomb) {var bomb: int = 1 ;}}

    dynamite.addEventListener (MouseEvent.CLICK, buttocks);

    function bum(e:MouseEvent):void {}

    If (sonido) bombsoundChannel = bombsound.play ();

    -bomb;

    If (bomb == 0) {}

    If (dynamite.parent) {dynamite.parent.removeChild (dynamite) ;}}

    kill every1

    }

    function level1(): void {}

    If (level == 1) {}

    addChild (nivel1pic);

    If (bomb > = 1) {addChild (dynamite) ;}

    }

    }

    function level3(): void {}

    If (level == 3) {}

    removerViejoNivel();

    addChild (nivel3pic);

    If (bomb > = 1) {addChild (dynamite) ;}

    }

    }

    function level5(): void {}

    If (level == 5) {}

    removerViejoNivel();

    addChild (nivel5pic);

    If (bomb > = 1) {addChild (dynamite) ;}

    }

    }

    function level7(): void {}

    If (level == 7) {}

    removerViejoNivel();

    addChild (nivel7pic);

    If (bomb > = 1) {addChild (dynamite) ;}

    }

    }

    function level9(): void {}

    If (level == 9) {}

    removerViejoNivel();

    addChild (nivel9pic);

    If (bomb > = 1) {addChild (dynamite) ;}

    }

    }

    function level12(): void {}

    If (level == 12) {}

    removerViejoNivel();

    addChild (nivel12pic);

    If (bomb > = 1) {addChild (dynamite) ;}

    }

    }

    function updateLevel(amount:int):void {}

    level += amount;

    Level1();

    Level3();

    Level5();

    level7();

    level9();

    level12();

    }

    Level1();

    Level3();

    Level5();

    level7();

    level9();

    level12();

    Thank you!

    Use the function trace to track when the bomb is added.  IF this happens in each of the functions level, then add traces to everyone to see where and when that happens.

  • Problems with namespaces in e4x

    Hi all

    Don't know what is happening to this site - but when I searched previous discussions on xml or e4x, I got 0?

    I am trying to generate a file styles.xml for a document to read Open Office open document formats. I added all the namespaces in an XML variable on the first line, and then added a child to the police statements. At this point, the XML looks like this:

    <-styles of the document xmlns:style = "urn: oasis: names: tc: opendocument:xmlns:style:1.0" xmlns:text = "urn: oasis: names: tc: opendocument:xmlns:text:1.0" xmlns:table = "urn: oasis: names: tc: opendocument:xmlns:table:1.0" xmlns:draw = "urn: oasis: names: tc: opendocument:xmlns:drawing:1.0" xmlns:fo = "" urn: oasis: names: tc: opendocument:xmlns:xsl - fo-compatible: 1.0 "xmlns:xlink =" " http://www.w3.org/1999/xlink "xmlns =" " http://purl.org/DC/elements/1.1/ " " xmlns:meta = "urn: oasis: names: tc: opendocument:xmlns:meta:1.0" xmlns:number = "urn: oasis: names: tc: opendocument:xmlns:datastyle:1.0" xmlns:presentation = "urn: oasis: names: tc: opendocument:xmlns:presentation:1.0" xmlns:svg = "urn: oasis: names: tc: opendocument:xmlns:svg - compatible: 1.0" xmlns:chart = "urn: oasis: names: tc: opendocument:xmlns:chart:1.0" xmlns:dr3d = "urn: oasis: names: tc: opendocument:xmlns:dr3d:1.0" xmlns "" ": math ="http://www.w3.org/1998/Math/MathML"xmlns:script =" urn: oasis: names: tc: opendocument:xmlns:script:1.0 "xmlns:ooo ="http://openoffice.org/2004/office"xmlns:ooow ="http://openoffice.org/2004/writer"xmlns:oooc ="http://openoffice.org/2004/calc"xmlns:dom ="http://www.w3.org/2001/xml-events"xmlns:rpt ="http://openoffice.org/2005/report"xmlns: =" "urn: oasis: names: tc: opendocument:xmlns: of: 1.2 ' xmlns:xhtml ='http://www.w3.org/1999/xhtml" xmlns = "urn". : oasis: names: tc: opendocument:xmlns:office:1.0 "> "
    < do-face-decls / >
    < / styles of the document >

    at this point in the code if I have this path:

    trace (xmlBody.Child("font-face-decls").inScopeNamespaces ());

    I get a table with the list of namespaces. If I draw this:

    trace (xmlBody.Child("font-face-decls"). Namespace("style").prefix);

    I get: style

    But, if I try this:

    xmlBody.child("font-face-decls").addChild (< police: style-face / >);

    I get the prefix unbound - but obviously the prefix is bound as noted above (it can also be a problem with the hyphen, although perhaps?).

    It works:

    .styleNS xmlBody.child("font-face-decls") [0]: ['font-face'] = ' ';

    But it does not work (I have a tern is undefined error)

    .styleNS xmlBody.child("font-face-decls") [1]: ['font-face'] = ' ';

    What I'm after, is something like this:

    < do-face-decls >
    < police: style-face style: name = "Arial" svg: do-family = "Arial" style: do-family-generic = "swiss" style: do-pitch = "variable" / >
    < style: do-face style: name = "Arial Unicode MS" svg: do-family = "& apos; Arial Unicode MS & apos; "style: do-family-generic = 'system' style: do-pitch ="variable"/ >
    < police: style-face style: name = "SimSun" svg: do-family = "SimSun" style: do-family-generic = 'system' style: do-pitch = "variable" / >
    < police: style-face style: name = "Tahoma" svg: do-family = "Tahoma" style: do-family-generic = 'system' style: do-pitch = "variable" / >
    < do-face-decls >

    There, anyone know how it works?  I'm really at the end of my home!

    See you soon!

    In your code:

    xmlBody.child("font-face-decls").addChild ();

    You set a new piece of XML in:

    What makes if all goes well more obvious style prefix is loosed in

    This segment.

    You can set the prefix in this segment, or try to use 'default xml

    namespace.  See the doc for the use.

  • problems with actionscript 3.0

    Hey im having some problems with my blackjack game. The problem is that the program will not pit the first function and it goes directly to the next function. Can someone help me find the error?

    import flash.display.MovieClip;

    Stop();

    var cardArray:Array = new Array (kort1, kort2, kort3);
    var knapp:MovieClip = new stortrivas;
    addChild (knapp);
    Knapp.Width = 100;
    Knapp.Height = 50;
    Knapp.x = 100;
    Knapp.y = 200;
    knapp.addEventListener (MouseEvent.CLICK, spelare);

    function spelare(e:MouseEvent):void {}


    z = 0;

    for (var k: int = 0; k < 2; k ++) {}
    var pickCard1 = cardArray [int (Math.random () * cardArray.length)];
    var card1:MovieClip = new pickCard1();
    addChild (card1);
    card1.x = 250;
    card1.y = 300;

    If (k < 2) {}
    for (var n: int = 0; n < 2; n ++) {}
    card1.x = 250 + z;
    card1.y = 300;
    z = z + 50;

    }

    }
    }
    }
    knapp.removeEventListener (MouseEvent.CLICK, spelare);
    knapp.addEventListener (MouseEvent.CLICK, dealer);
    function dealer(e:MouseEvent):void {}
    z = 0;

    for (var i: int = 0; i < 2; i ++) {}
    var pickCard = cardArray [int (Math.random () * cardArray.length)];
    var map: MovieClip = new pickCard();
    addChild (card);
    Card.x = 250;
    Card.y = 100;

    If (I < 2) {}
    for (var j: int = 0; j < 2; j ++) {}
    Card.x = 250 + z;
    Card.y = 100;
    z = z + 50;

    }


    }
    }
    }

    There is no listener function that calls spelare().  immediately after the creation of a listener that calls spelare(), move you.

  • Problem with removeEventListener

    Hello

    I have a code:

    package 
    {
         import adobe.utils.CustomActions;
         import flash.display.MovieClip;
         import flash.events.MouseEvent;
         import flash.text.TextField;
         import flash.events.*;
         import flash.utils.getTimer;
    
    
         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;
              public var startTime:int = getTimer();
              public var timeString:String;
              
              private var playerScoreSum:int;//sum of all players points
              private var playerScorePreview:TextField;//showing players points to the window
              private var matchPoints:int = 20;//if player match 2 icons we add 20 points to his playerScoreSum
              private var missPoints:int = 1;//if miss we delete 1 points from playerScoreSum
              
              //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 startingStopwatch():void
              {
                   addEventListener(Event.ENTER_FRAME, stopwatch);
              }
              
              public function stopingStopwatch():void
              {
                   removeEventListener(Event.ENTER_FRAME, stopwatch);
              }
              
              public function stopwatch(event:Event) 
              {
                   var timePassed:int = getTimer()-startTime;
                   var seconds:int = Math.floor(timePassed/1000);
                   var minutes:int = Math.floor(seconds/60);
                   seconds -= minutes*60;
                   timeString = minutes + ":" + String(seconds + 100).substr(1, 2);
                   stopwatch_txt.text = timeString;
              }
              
              
              public function goToLevel_1(event:MouseEvent)
              {
                   play_btn.visible=false;
                   gotoAndStop('Level_1');
                   
                   startingStopwatch();
                   
                   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);
                        
                        if (firstIcon.showIcon==secondIcon.showIcon)
                        {
                             playerScoreSum += matchPoints;// +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
                                  stopingStopwatch();
                                  stopwatch_txt.text = timeString;//why i don't see time?
                                  gotoAndStop('GameoverScreen');//if player match all icons we go to GameoverScreen                              
                             }
                        }
                        else
                        {
                             playerScoreSum -= missPoints;// -1 point from playerScoreSum
                             playerScorePreview.text = String(playerScoreSum);
                        }
                   }
                   else
                   {
                        firstIcon.gotoAndStop(1);
                        secondIcon.gotoAndStop(1);
                        firstIcon = null;
                        secondIcon = null;
                   }
              }
              
         }
    
    }
    

    There is problem with my clock.

    Code for timer:

    public var startTime:int = getTimer();
              public var timeString:String;
    

    public function startingStopwatch():void
              {
                   addEventListener(Event.ENTER_FRAME, stopwatch);
              }
              
              public function stopingStopwatch():void
              {
                   removeEventListener(Event.ENTER_FRAME, stopwatch);
              }
              
              public function stopwatch(event:Event) 
              {
                   var timePassed:int = getTimer()-startTime;
                   var seconds:int = Math.floor(timePassed/1000);
                   var minutes:int = Math.floor(seconds/60);
                   seconds -= minutes*60;
                   timeString = minutes + ":" + String(seconds + 100).substr(1, 2);
                   stopwatch_txt.text = timeString;
              }
    

    When I come to the 'goToLevel_1' function I start funciton "startingStopwatch()";

    So all work I see my stopwatching... time goes...

    Then when I go to a gameover screen I don't see a timer:

    if (deletedIcons == 0)
                             {
                                  //myTimer.Stop();//stoping timer, so now we know how time player spend to playing the level 1
                                  stopingStopwatch();
                                  stopwatch_txt.text = timeString;//why i don't see time?
                                  gotoAndStop('GameoverScreen');//if player match all icons we go to GameoverScreen                              
                             }
    

    Why his arrival?

    And another question:

    When I click to play_btn I see error in the output window:

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    to MyMatching / stopwatch)

    How can I solve this problem?

    Thank you.

    1009 error indicates that one of the objects targeted by your code is out of reach, and I suspect that this means your textfield stopwatch_txt.  This may mean that the object...

    n ' is not in the display list
    n ' is not have an instance name (or the name of the instance is misspelled)
    n ' is not in the frame where this code tries to talk to her
    -is animated in place, but is not assigned the name of the instances of each keyframe for her
    -is one of the two or more keyframes consecutive same objects with different names assigned.

    If you go to your section to publish the Flash settings and select permit debugging option, your error message should have a suite of line number the number of the frame that will help you to isolate the object that is involved.

  • problem with resizing and remove

    I have a problem with resizing images after loading, not all of the images has the scale ratio 0.75... so for the most part, I just stretch the images having the ratio...

    is there a good method of resizing/scalling? for example enjoyed.

    and once I've loaded images, I add in the imageContainer.

    I couldn't find a way, if I click on the next thumbnail, she remove the last child (image) of the imageContainer...

    I'm confuse ATM please point me in the right direction...

    Thank you

    Load the image clicked

    function mouseClickThumb (e: Event): void {}

    var thumb: thumbnail2 = e.target as thumbnail2;

    var linkName:String = e.currentTarget.name.toString (); get the name of the link

    var imageLoader:Loader = new Loader();

    var urlRequest:URLRequest = new URLRequest (linkName);

    imageLoader.load (urlRequest);

    imageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);

    function imageLoaded(e:Event):void {}

    var image: Bitmap = (e.target.content) Bitmap image;

    image.x = 0;

    image.y = 0;

    somehow if I resized the images here, it didn't turn right for all...

         }

    imageContainer.addChild (imageLoader);  / / How can I delete the last image? if click on the following icon?

    }

    If you want to remove the last (highest in the display list) child of a container, you can do this way:

    var numChild = imageContainer.numChildren ();

    imageContainer.removeChildAt (numChild - 1);

    don't forget display lists starts with 0, not 1, so you must always subtract 1 to get the level number of the child in the foreground

  • Problem with &lt; b &gt; htmlText tag!

    Hello

    I have a problem with htmlText in AS3. I create in the font library. Regular and a "BOLD" of NeoSans version and export for actionscript. The < b > tag works, but the problem is that when I do it on my project, the police is not sharp and ugly but if I do the same step by step as3 empty of police project looks just great. I don't know what makes a difference. Please help me.

    I post images. I tried to create the same box htmltext in a different place in my project and fonts there seems too perfect. Only in the movieclip that I want to put my htmlText police don't is not look like that should look like (not sharp and ugly like the screen). I have no idea why it looks like this, in this one movieclip.

    PS Sorry for the bad English.

    use css to do this:

    var css:StyleSheet = new StyleSheet();

    "BOLD" var: Object = new Object();
    Bold.Color = "#000000";
    bold.fontFamily = new Yourboldfontclass (.fontName);

    regular var: Object = new Object();
    Regular.Color = "#000000";
    regular.fontFamily = new Yourregularfontclass (.fontName);

    css.setStyle (".reg", regular);
    css.setStyle (".bold", "BOLD");

    var tf:TextField = new TextField();
    tf.embedFonts = true;
    tf.styleSheet = css;
    addChild (tf);
    tf.htmlText = "Ut accumsan urna lobortis, and ullamcorper diam dictum vitae." Nullam ultrices, massa sit amet tincidunt dignissim, feugiat sem odio, nec, quam restore augue commodo eros massa. Pellentesque elementum lectus enim accumsan blandit mi. In volutpat imperdiet tincidunt. Surpassing in purus sit amet tempus auctor lectus auctor magna varius. CRAs hendrerit metus, sit amet orci faucibus eget bibendum ultricies. Proin ut odio nisl. Etiam nisi justo, ornare in, ultrices a, auctor id nulla. Mauris dictum aliquet sapien, sed dapibus enim tempor eget. Aenean tincidunt viverra nulla sollicitudin tincidunt sodales AC Vivamus imperdiet leo in ultricies vehiculasapien dolor. Integer adipiscing fitness Hall. « ;

  • problems with, phone, 6, Bluetooth kit, Nissan, after update, for, Rios, 1.0.2

    After the update to ios 10.0.2 - trying to use bluetooth to call my vehicle, it says: "this article is not in your phone book." How can I solve this problem?

    Greetings, joybelino1!

    Thank you for joining the communities Support from Apple! I can't wait to see that you are having problems with your Bluetooth in your car! The good news is that Apple has a great article that will help you with measures to try to resolve the problem. Read this article to gethelp to connect your iPhone, iPad, or iPod touch with your car radio. Even though he talks about problems with the connection, it also has the steps for other questions you may have once connected.

    If you use Bluetooth

    1. Consult the user manual of your car stereo to get the procedure to a Bluetooth device.
    2. On your iOS device, drag up to open Control Center, then press ontwice to turn on Bluetooth and turn it back on.
    3. Restart your iOS device.
    4. On your iOS device, Cancel the twinning of your car radio. On the screen of your car désapparier your iOS device and any other device. Restart your car and your iOS device, then pair and connect again.
    5. Update your iOS device.
    6. Install the updates to the firmware of your car radio.
    7. If you still not connect, contact Apple technical support.

    Have a great day!

  • Anyone having problems with WiFi connectivity after upgrade to Sierra?

    I was wondering if anyone else knows issues with WiFi connectivity since the upgrade to Sierra 10.12? I have not had any problems with connectivity WiFi previously on El Capitan. Now I have regular randomly loose connectivity. My internet is cable and when it is connected I have a 100% connection. My details of iMac and I have used only 10% of my storage.

    No problem with my iphone 6.

    Hello AspDesigns,

    I understand that, since the upgrade to Mac OS Sierra, your Mac seems to have trouble staying connected to Wi - Fi. Fortunately the diagnosis built-in wireless can help identify the source of so much trouble.

    Search for Wi - Fi using your Mac problems

    See you soon!

  • Problems with mail after switching to macOS Sierra

    Hey all

    After having recently upgraded to macOS Sierra, I am unable to read my mail.

    I get the following error every time I check on "Get Mail".

    There may be a problem with the mail server or the network. Check the account settings "*" or try again.

    The server returned the error: Mail could not connect to the server 'pop1.tribcsp.com' using SSL on the default ports. Verify that this server supports SSL and that your account settings are correct.

    What does this error message mean and how can I solve this problem.

    Thank you

    Hi Michael,

    I see your message that you get an error in the mail indicating that there is a problem with the mail server or the network.  To help get this problem resolved, I suggest that you follow the steps below:

    If mail refers to a problem with the mail server, or the network

    Mail will say that it is impossible to connect due to a problem with the mail server or the network. For example, the message may refer to a connection that has expired, or too many simultaneous connections:

    If you are connected to the Internet, but the connection has expired, your email provider might be affected by a discontinuance of service. Contact them or see their status Web page to ensure that their e-mail service is online. Examples of status pages:

    If the message indicates the number of simultaneous connections, too many of your devices is check your e-mail account at the same time. Quit Mail on one or more of your other devices.

    If you are still unable to send or receive e-mails

    1. Make sure that you have installed latest version of the Mac software updates, especially if the problem occurred immediately after the installation of a previous update.
    2. In OS X El Capitan or later version, you can see a status icon and the short error message in the upper right of the Mail window, under the search box. The message may indicate 'Network offline' or 'Connection failed', for example. Click the message to see more details on the issue.
    3. Check your connection to the Mail connection doctor. It might be able to say more on the issue.

    If you cannot send or receive e-mail on your Mac.

    Take care.

  • iMac 27 "mid-2011 - Intermittent problem with CPU fan running at full speed and sleep mode.

    Hello!

    My iMac 27 "has an intermittent problem with the CPU fan runs at full speed. Sometimes it happens at the time when I start it, sometimes only in my session, and sometimes only after a certain time. So does seem to be a problem of "heating".

    Second issue is with the mode 'sleep'. It may occur also at any time, at the start of the iMac, session, or after a certain time. But once he starts to go in mode 'sleep', when I wake up, it goes right back in mode after a few seconds and that it will continue indefinitely until I restart the computer.

    What could be?

    Please help me!

    4ntoine

    Here is my model of iMac:

    iMac 27 "mid-2011 model 12.2

    Intel Core i7 3.4 GHz

    AMD Radeon HD 6970M 1024 MB

    OS X El Capitan 10.11.6
    SMC 1.72f2

    Boot ROM IM121.0047.B23

    reset the SMC

    Reset the management system (SCM) controller on your Mac - Apple Support

  • problem with playing the clash of clans

    I'm having some problems while playing the clash of clans on my 2 mini ipad screen does not seem to meet sometimes as if it was some sort of delay so I have to tap several times in order to use a filter or throw the troops on the battlefield.

    Hi Trinitygr,

    Thanks for posting in the Community Support from Apple! I understand that you are having problems with your iPad screen while playing a game. I like to play games on my iPad and I don't see how this could be a nuisance. I'm happy to offer assistance.

    Are you only had this problem when using the app clash of Clans, or does it happen in all applications? I recommend to start by following the steps described in this article:
    If an application you have installed unexpectedly closes, unresponsive, or does not open

    Take care!

Maybe you are looking for

  • Portege R600 wake 'making Hibernate'

    Hello After "don't start stand of Modus", now we have the same problem with the Hibernate mode.After 45 minutes in battery operation, the R600 go for hibernation (hibernation is sought, in this doesn´t mode it needs battery power). Now, the Portege i

  • HP Solution Center no longer works after update of HP Officejet J6480

    HP will provide an update to fix this problem?  If anyone has had the same problem (if so, how fixed?)? HP has pushed down the updates on a week earlier for my HP Pavilion Elite e9270f running Windows 7 64 bit home and domestic all-in-one Officejet J

  • You can disable the automatically load a random number of Freecell game first starts?

    FreeCell startup in Windows 7, it automatically loads a game of chance.  I don't want it.  I ALWAYS want to choose the number of game I want to play.  Yes, I can choose the game - after - the cards are dealt, but then I have to accept defeat on the h

  • How to customize a report for pre printed paper printing

    A pre printed paper (for example, an invoice) must have the following: How to print the following 1. to print the total bill in a rectangular box to display the total in a pre printed paper 2. to print the details (which may varry for each invoice) o

  • How to block storage Sites online

    Customer a TZ210 with Global Security Gateway protection license. He is not ready to block everything and whitelist a handful of web sites, but is concerned about people stealing data by loading up on DropBox or OneDrive. How can he block the website