I have an event driven flash program. I need to be able to call removeChild() if and only if an object is a child. getChildByName() and most other functions don't seem to allow for this and if you call removeChild() on an object that isn't a child it will throw an error. I suppose an option may be to catch the thrown error and just ignore it, but that seems like a bad solution.
My page has 2 tab menus. When the page first loads, it defaults to the first tab, but when the second tab is hit, an image is loaded to the stage. I want to remove the image from the stage once the first tab is hit again.I keep getting the error "Access of undefined property Image1" but the whole point is to check if this child exists with the if statement.
//Tab 1 if (Image1 != undefined) { stage.removeChild(Image1);
I m making a basic menu effect. Normally I would animate all this in flash on the timeline but im trying to learn as much as i can about coding. I was actually impressed that i was able to create just this simple animation, but i want to write a conditional that lets me see if a child exists on the stage, if so remove it, if not run a function. Heres where I am so far.[code]as you can see the hardware text drops down and comes in from the top but stays on screen when you mouse out.basically what i want to do in my hardwareOut function is to run a conditional to see if topText exists, if so remove it and if not then gotoAndPlay().
I have been through many threads and none have helped. I am trying to remove a child if it exists. I am clicking on the button and sometimes there is no other child loaded. I want some code that looks to see if a child is loaded and then if so unloads. There are going to be at lease 5 possible .swf files loaded. [code]
I'd like to remove a child of the display list if it exists before adding another to the stage. This gives me Error the first time I call it because 'myMC' doesn't exist.
HTML Code: function callMc(){ if(myMc) removeChild(myMc);
How can I determine if a child is present or not in a movieClip?
I'm trying to set up a conditional to determine whether or not a specified child object is present and if so, remove it. I'm having trouble finding relevant documentation on this.
How can I get the X, Y, and rotation values, relative to the stage of a child of unknown number of parents?What I am doing is: I have a 'stick' object, that creates a child 'stick', that creates a child 'stick', etc a random number of times.The end stick then creates a leaf. Each new stick rotates a little bit randomly.As a result when my leaf falls off the final stick it flies off in a strange direction.How can I get the leaf to fall down (eg y++ relative to stage)?Alternatively I thought I could dispatch an event that has a leaf created at the stage level but then I really need to know what the X and Y co-ordinates of my final stick is realtive to the stage.
With this code, I need to determine if the xml child is null and form a conditional statement upon that info.I have it very close but something is just "un-tweeked" enough that it wont work correctly.AS3 and XML provided below...
Code: var url = txtBox_mc.getTix.url; var request:URLRequest = new URLRequest(url); txtBox_mc.getTix.addEventListener(MouseEvent.CLICK, GetUrTix);[code].....
The problem now only the " if (url == null) { " is read, thus returning those results. I believe the issue is within the definition of url " var url = txtBox_mc.getTix.url; "...
Let's say I have a canvas with a fixed height and a vertical scroll bar. And the canvas has 10 children in a vertical line (like a VBox) whose combined height exceeds the height of the canvas. Based on the scroll bar position, only some of the children will be visible at a time.Is it possible to determine which children are actually visible? Or whether or not a specific child is visible on screen?
I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage
I have a gallery loading jpegs from an xml file into a mc called mainPicArea, on frame 5. I have other content on frames 1,2,3,4,6,7.I want to run an if statement to check whether mainPicAreaexists and if it does, then run a removeChild(mainPicArea), and if not do nothing.
code: if (MovieClip.mainPicArea){ trace("exists"); //removeChild(mainPicArea);
[code]....
this is my code. When I test, it comes back with the trace "doesent exist", even though it does exist.
Is there a way to see if a class exists? something like:
if( MyClass exist in the Library or has been imported in to the class ){ var myClass = new MyClass() addChild(myClass); }else{ trace("MyClass doesn't exist") }
I'm not trying to see if it exists on the stage just want to know if I have access to it.
Im gonna make an image gallery that loads thumbnails 1.jpg, 2.jpg 3.jpg..etc... into thumbnail mc's it creates, and when it gets to a number of a file that doesnt exist i want it to stop making thumbnail mc's. What AS could i use. As of right now it trys to load the jpg that doesnt exist and the preloader keeps going forever.
i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application
<mx:VBox id="content" width="100%" height="100%" ></mx:VBox> public function doIT():void {[code]....
when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?
I have a movieClip with one frame on the timeline containing one child whose instance name is "myContent"I am using this function to swap "myContent" with any number of possible class instances.
I've used this site as a resource leading up to this, not particularly sure if I worded this correctly I have a class "Block" which is just a square (will be something else later on in the process) I want each block to have controls to add an additional block in either direction so I have another class BlockButtons which has my buttons for each direction.
And another class GlobalVar where I keep all my variables for funsies
I have a component mxml file in which i have a view stack, on click of a button i navigate to the first child, now i need to navigate to the second child during onclick of a button present in the second child. All the childs are component files included within the view stack. How could this be done, Sample code is present below,
[code]...
Now in my offering.mxml file if i try to access navigationViewStack i am getting an error stating 'Access of undefined property navigationViewStack.
I've seen some discussion on how to load a child swf using swfLoader and accessing it's variables but I am wondering if it is possible to do this without adding any code to the child swf.Either accessing public vars or listening for funciton calls would work fine
i'm new to AS3 and i was wondering what is the best way to remove a child at a point. i tried Holder.removeChild(Holder.getObjectsUnderPoint(new Point(exampleX, exampleY))[0]); however that returned ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
I have an Movie Clip in Flash that have subobject of button type which has subobject of input text and movie clips. Right after creation core Moveclip all subobject are set to null, when I expect them to be valid objects.
[Code]...
MC_Core_design was created in Flash and exported to Actionscript. I've done this for button_1 class aswell. The code was written using Flex. When I comment out both lines that result in error I get correct view of the core Movie clip with all subobject. How can I set subobject properties right after object creation?
a quick low down would be its a gallery on the second frame and I breaks when coming back tot he first frame, all tweens die and such.
the errors are:
TypeError: Error #2007: Parameter child must be non-null. at flash.display:isplayObjectContainer/removeChild() at index_779_fla::MainTimeline/imageLoaded()