ActionScript 3.0 :: Retrieve Instance Name Parent Challenge
Jan 16, 2010
An external application sends an instance name to flash over TCP/IP.I have code that parses out the communication and retreives the instance name (not it's absolute path).I then need to retreive the instance name's parent in actionscript. The instance name that gets sent is a child of specific movieClip, there are several movieclips on the stage. I need to know it's specific parent name..the code is placed on the main timeline.
View 3 Replies
Similar Posts:
Jun 15, 2007
is it possible to retrieve all children of a certain type from a parent in actionscript 3?i only see getChildAt,getChildByName, is there a getchild of a certain type like get all childs of object type:Food?!!!
View 3 Replies
Jan 3, 2012
how do i retrieve the top level parent of an xml node in actionscript please?
<companies>
<company id="1" name="boo" level="1">
<company id="2" name="hoo" level="2">[code]......
View 1 Replies
Jul 13, 2009
I will try to state this simply. If required I can post my code. I have created a class that extends the MovieClip. It is basically a retangular shape, with a color and a label that can be set via the "properties" concept. The label.text property is public.
I create a "new" object of this item (more or less a button) depending on reading an xml file.
If the file has 3 names (titles like "Lesson 1", Lesson 2" etc). I create a new "button" for each name in the xml file.
so I can get 3 instances of the object on the stage. Which I get. I create each new object like this:
var link:linkBase;
var menu:linkBase;
I use a for loop to read the xml data, and create the instances:
for ....
menu = new linkBase();
// i try to give it an instance name like the
menu.name = xmlList[i].name // name = "Week1", "Week2", "Week3", etc
i push the menu object into an array like this: nav_button.push(menu), in the for loop.
I can draw the three objects on the stage. I have a stage listener that will trace the target name if I click on the instance. I get "null" if I click off the button. My problem is that I get the target name for only the second and third instances, and not the first. If I comment out the menu.name line, and click each instance on the stage, I get "instance9", instance12, instance15. So I know there are three objects there.
I can do something like this to get a name on the first instance: nav_button[0].name = xmlList.week, or hard code a string like "Week1".
But I want to be able to do this in a loop of some sort. I am trying to create a user friendly name for each instance, so I know what I am clicking on, and take action depending on the name "week1", "week2" etc.
what I am missing in terms of naming a instance on the stage?
View 3 Replies
Jan 20, 2006
I need to retieve the instance name of a button but cannot do it the same with a dynamic button the same as I can with a component button.For a built in component button the below code would output _level0.buttonName, however for a dynamic button i have created it only outputs _level0.
on (release) {
trace(this);
}
how to get the instance name of dynamic buttons?
View 2 Replies
Jul 21, 2010
I have a "MainSWF", that loads and places other SWFs "LoadedSWF". The LoadedSWF has buttons that are supposed to make some layers in the MainSWF visible/invisble. These layers are in a placed navigation bar that is defined as a symbol, was placed on the Main Stage and given the instance name "FlashStageMainNavigation". I have a hard time figuring out how to address the layers in the MainSWF, because it seems I am missing something.
When I use a loop to trace all the child instances on the stage of the MainSWF with:
this.getChildAt(i).name
I get the following info:
instance1 this.name=0
FlashStageMainNavigation this.name=4
When I trace stage.getChildByName(this.name) in MainSWF I get "FSMain", which is the name of my main Class
My assumption was, that I could (from the LoadedSWF) address the Navigationbar in the MainSWF by using something like:
stage.FSMain.FlashStageMainNavigation.visible = false; //or
stage.getChildByName("FSMain").FlashStageMainNavig ation.visible = false; //or
stage.getChildByName("FlashStageMainNavigation").v isible = false;
neither of that worked.
To sum up/rephrase my question: How can I find out, which object instances are placed on the stage and how do I address them from the LoadedSWF?
View 4 Replies
Dec 13, 2009
I have a stage with instances of bauble_mcs on it that are attached by the document class of the main timeline (can someone tell me what the right term is here? I don't know what I call the main time line in AS3).I then have instances of snow_mc attached by the same class. Inside the snow_mc I want to test to see if it is hitting any bauble_mcs but I don't know how!
inside snow_mc I am trying:
PHP Code:
if(this.hitTestObject(this.parent.bauble_mc)){
}
to which flash says:
1119: Access of possibly undefined property bauble_mc through a reference with static type flash.displayisplayObjectContainer.
View 1 Replies
Sep 15, 2010
If an object, or say... a document class, creates an instance of a class (and stores it as a variable), and it doesn't pass any arguments to the constructor of the class, can that class object, by simply having a function of it called by the parent, tell who sent it that command/request?In other words, can a class object know who called it (such as it's parent) via a (seemingly) anonymous call?
View 1 Replies
Nov 3, 2011
Just wondering how I reference A button that I have within a movie clip, within a movieclip to and instance on the parent timeline.At the moment I am using, but not getting the correct result:MovieClip(parent).NavBar.gotoAndPlay("About");
View 1 Replies
Apr 8, 2010
one of my problem is that how do i call the instance name of a button from my child.swf to my parent.swf
i have four buttons from my child.swf where when i click btn1 it will load superchild.swf but i want to load that superchild.swf to my parent.swf, like instead btn1 calls superchild.swf to load, btn1 will call parent.swf then on parent.swf it will distinguish that btn1 was click from child.swf and it will now load superchild.swf.
View 3 Replies
May 24, 2011
In a nutshell, this project is an eLearning course template. It needs to be able to load/unload individual page swf and these page swfs need to communicate back up the chain to some level for this like module / course completion. On the stage I have a pageLoader_mc linked to a PageLoader class. What I need up doing is added my LoaderObject to the display list of my pageLoader_mc MovieClip:
Code:
package {
import flash.display.MovieClip;
import flash.events.*;
[code]....
The Swf of the course loads. When you go to another page after it unloads the SWF I get an error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::AVM1Movie@37710d61 to flash.display.MovieClip.
at PageLoader/loadComplete()
The Overall question, is how can I instance that loaded SWF so I can listen to custom events? In my loaded swf I guess I can "MovieClip(stage.pageLoader_mc).CallMyFunction "
View 2 Replies
Jun 8, 2009
I need a method to move a node up the XML hierarchy(to the same level of its parent), so if I had an XMList that looks like this:
[Code]...
</node>etc! I could probably work this out myself, but thought someone might have encountered this scenario and achieved this already...
View 3 Replies
Jun 25, 2009
I am getting ready to update a past client's website using newer web standards. This particular website has a Flash Intro on the index.html page. I have a feeling this has greatly hindered search engine activity. What would be the best way to handle keeping a Flash intro without it being logged as a main page? Or should I recommend that the client eliminate the Flash landing page?url...
View 11 Replies
Aug 17, 2009
Given a few months on my own, I could probably hack something together, but an experts input would be much nicer.This is a custom Google Voice widget/form. I have the backend code, and can share, but right now I need all these pieces to fit together. It is mostly ELSE/IF statements, starting with the first page, and transitioning to the next widget page depending on the data input, correct or incomplete/incorrect as the variables determining which widget page to open.This will definitely take some Flash skills too, but minimally.Currently the SCENE1 page just shows each of the different widget pages and is not meant to represent the final widget - the final widget will be the first page and when clicked transition to a widget/form different page in the same spot, and again, depending on the input.If you want to give it a try, you can download the .FLA here:
FYI: This same widget HAS been sucessfully programmed in AJAX, with it's tons of code and multiple files, but the challenge was to make it work the same way in Flash. This is the very first TRUE custom Google Voice widget - all others I've found are custom icons that when pressed launch Googles GV widget - so this widget is one of a kind! You can view the working widget and download all the AJX components here if you'd like
View 5 Replies
May 19, 2010
I'm in a bit of a pickle and can't sort my way out. I'm loading an external swf that has a preloader on Scene 1, and the main content on Scene2. While the content on Scene 2 centers nicely, the preloader content refuses to do so.
Here's what I've got on my main project timeline:
Code:
mcHMI.onRollOver = function() {
this.gotoAndPlay("over");
} mcHMI.onRollOut = function() {
this.gotoAndPlay("off");
[Code] .....}
As mentioned, the swf loads just fine and stays centered at any resize. The preloader will jump to another position when you resize.
View 0 Replies
Jan 12, 2004
I was thinking about this today, when i was using my new Makita I got for Christmas.How can I simulate a drill in flash?
View 6 Replies
May 21, 2010
I'm in a bit of a pickle and can't sort my way out.I'm loading an external swf that has a preloader on Scene 1, and the main content on Scene2. While the content on Scene 2 centers nicely, the preloader content refuses to do so, lol.Here's what I've got on my main project timeline:
Code:
mcHMI.onRollOver = function() {
this.gotoAndPlay("over");
[code].....
View 6 Replies
Feb 16, 2010
[URL]This site loads in all of the large images behind the scenes, so once you click through a project, the images appear immediately.
Ben.
View 2 Replies
Feb 2, 2006
ive been trying to modify this text drag script to enable it to use the mouse wheel. ive managed to make it scroll with the mouse, but i cant seem to make it limit itself to the boundaries of the mask, like the dragger behaves. it just keeps scrolling upwards or downwards to infinity. i was thinking if there was a way to make it behave like the dragger. here is the script if u want to take a look. at the bottom i added the mousewheel listener and attached it to the dragger, and it works perfectly, but as i said, it doesnt stop like when you click it and drag it.
[Code]...
View 10 Replies
Feb 5, 2010
[code]All clips are squared.Ok, on the PlayerPlane, there are little soldiers, which have hotkeys. The effect I'm trying to create is I want to position the GameStage so that the currently selected soldier appears in the center of the GameClicker clip.The GameStage is movable by the player (to scan other areas of the map)by holding the CTRL key, so it's easy to kinda lose track of where your players are.I have tried using localTo Global and globalToLocal techniques, but I think I'm lost on the actual math of getting the GameStage to move the correct distance so that the selected soldier is centered to the GameClicker.[code]
View 2 Replies
Jul 21, 2010
So im opening it up to the commuity as a programming challenge!!For something which i assumed would be very simple, writting a robust and solid multi turn spinner handle for flash in as3 has become the bane of my life.Feel free to download my attempts so far (attached), which cover the basics of a single rotation, and make it look like im further ahead than i actually am.The difficulty lies with the very specific things I personally need the spinner to do,and the fact its SO HARD to explain..Its actually used to control a piece of animation that is 72 frames long.I need the first "lap" of rotation to send the playhead to frames in the 1-36 range and the second rotation to send it to frames 37-72. So two full spins would take it to the final frame, one full spin would go half way to frame 36.
Problem is the rotator handle needs to be locked at the initial position, so a user can't drag it backwards to start with but can drag it backwards once theyve moved forwards. (think of turning on a hot water tap, many turns in one direction until it stops fully on, then the same turns back again to reach the original start position of fully off)I also need the rotator to be able to be used in anti clockwise and clockwise modes.The ideal is to be able to set the total number of animation frames to be controlled and the number of rotations required to reach the final frame, then have the spinner work everything else out for me.
View 3 Replies
Jan 3, 2010
I got a "preloader" that creates an movieclip and loads an SWF. Now in the loaded SWF i want a close button to go back to the "preloader". The preloader isn't an actuall preloader but some sort of mainclip.Now i tried this:removeChild(MovieClip(e.currentTarget).parent.pare nt.parent)But i get error:ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display::DisplayObjectContainer/removeChild()at MethodInfo-6()
View 1 Replies
Mar 20, 2009
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 Replies
Jul 20, 2009
I am trying to create a draggable wall (so the wall is 20x bigger than the stage) on which I can place movable/draggable post-it notes, so if I hold onto a post-it note only that specific one drags (these will be individually lockable on the stage) If the user "grabs/holds" the "wall" and moves it, then all the post it notes will move with it. (even the locked ones)If a post-it is locked, then only that specific one is not movable. (This is easy enough to do (Just disable the post it)
View 9 Replies
Jul 10, 2009
I'm currently making a platform game and when the player shoots i want to add the bullets to the stage. The players gun class is in charge of adding bullets. The "players gun" is a child of "players gun holder" which is a child of "player" which is a child of the stage. is there a better or more dynamic way for the "players gun" to add bullets to the stage rather than using parent.parent.parent.addChild (bullet);
View 2 Replies
Sep 11, 2010
if I add a clip to the stage as a child and remove the parent and set the parent equal to null, does the child get collected and removed from memory? What if the child has an image loaded into it as its child?
In my application I'm loading a series of png images as overlays that can be tinted for customizing in this app. When I trace my memory, the basic app idles at 64,000 k. The exact second I load those overlay images it goes up to 205,000k. If I remove those clips and "clear" the stage I should go back down to 64,000 k if everything is removed and collected correctly, right? It's not, it's hanging at 215,000 k. Are my images being cached and that is the reason for the memory staying up? If so, how do I prevent that. Or upon removing the parent of the image how can I un-cache the image.
If a user switches between models and loads several different items then the application actually crashes the Flash environment because of too much memory usage. It also does the same to browsers.
View 29 Replies
Mar 15, 2011
I am trying to access a function that is on my document class for my AS3 project, from a nested class. That is, the Document Class calls Class A which then calls Class B. So I am trying to access a function from Class B, I am trying to use MovieClip(parent).function(); but I am getting error 1120. The MovieClip(parent) (fixed to reflect my document class, etc) works when I try it from other classes but not from this nested class.
View 9 Replies
Nov 13, 2010
Simple drag and drop application where mc is dragged out of one parent mc and dropped into another parent mc.All works OK until I added 2 text boxes to the mc's -- one is a non-selectable dynamic text box (a label) which is set by the code, the other is selectable input text that the user can amend.
Finger cursor disappears when user hovers over the section of the mc that contains the text fields (even non-selectable text??) When the user trys to drag the mc by inadvertantly click-dragging anywhere within both text areas it causes this error: TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@2374a381 to flash.display. MovieClip (same error appears for both text boxes)
The input text box may confuse the user - how do they sometimes click to drag and sometimes click to amend? I need to create an overlay area within the mc that is click-detected for the drag? Here's the relevant bits of code:
var itemArray:Array = [
{iname:"police",ititle:"POLICE OFFICER"},
{iname:"insurance_assessor",ititle:"INSURANCE ASSESSOR"},[code].............
View 1 Replies
Nov 11, 2009
I have a parent swf which loads many child swfs (though only one is displayed at a time). My intention was to use the loaded SWFs document class to retrieve an array of objects to be assigned a tab index, combine this with the parent's own array of objects and apply sequential tab indices to them all. But what happens is actually that the parent's objects are assigned an index, but the external swf is unaffected. In fact, the external swf retains its automatic tab indexing, when I would expect that having set a value for InteractiveObject.tabIndex, automatic tab indexing would be disabled.
I've seen similar tales elsewhere. Most posts I've read are wanting to load an external swf, give it focus and loop through those objects, then close the swf and return to looping through the parent. However I would like loop through all objects as one. including manipulating the focus manager(s), and basically fiddling with every tab-related property I know.
View 2 Replies
Dec 10, 2009
I've struggled with this for a long time and have thrown in the towel. How the heck do you climb the ladder, then go back down again into another clip?
View 2 Replies