ActionScript 3.0 :: Can'#t Access Children?
Feb 1, 2010
I have a simple class to create some buttons:
Code:
package {
import flash.display.*;[code]....
brings up "access of possibly undefined property" I do have other mcs etc within that container which don't have a ref but also trace (this.container.getChildAt(5).ref) doesn't work and I know number 5 is one of the ones that does have a ref.How do I use the ref to target the buttons.
View 2 Replies
Similar Posts:
Jan 12, 2011
I have a Sprite called pageContent. Inside pageContent are 12 more Sprites with unique names, a couple of Buttons, and some TextFields. Inside each of the 12 Sprites I have either one or two TextFields and one TextInput. My question is, since they are children inside a child of pageContent, how can I access them? Here is how I am trying to do it:
[Code]...
In my mind, this should totally work. But surprise, surprise, it doesn't. I have debugged it and it works fine for the first two lines, but when it tries to get numChildren of a Child of pageContent (line 3), I get this error: PHP Code: 1119: Access of possibly undefined property numChildren through a reference with static type flash.display:DisplayObject.
View 4 Replies
Mar 10, 2010
I have a Canvas which has many components inside it and those again, have many components inside them.
getChildren() returns only the top level children. What is the best way to retrieve all the children (children of children of children and so on).
Well, I sorta know how to do this by iterating through the children, but the code is really messy. I'd prefer to use a nice recursive function. Has anyone written this before? Or is there a Util class to do this?
View 3 Replies
Jul 25, 2011
I'm trying to access the childrens from an external swf previous loaded. This swf is a movieclip exported as swf which has two movieclips inside also.It loads the movieclip, but when I try to access to his childs, there is no one. What I'm doing wrong? I'm missing something when I export or load in AS3? I'm loading the swf as:
itemLoader = new Loader();
itemLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, itemLoaded);
itemLoader.load(new URLRequest("path"));[code].....
View 13 Replies
Feb 17, 2010
Does anyone know if its possible to access children elements in a SWC? I have created some MC's and inside of some of these MC's I have some dynamic textFields. I export the content to a SWC and load it into my Flex project. No problem loading it or accessing the parent elements, they display fine. But I want to access the textfields nestes in the MC's and modify the text. When I debug the app, I can see the textfields as child elements. It's typed as a TextField and the Instance Name is the same as input in the Flash IDE but I cannot access it. When Flex compiles it throws an error saying it doesn't recognize the method. I've tried to insert actionscript on the timeline, linked external classes and nothing can be accessed.
View 3 Replies
Sep 20, 2011
I have multiple MCs which im creating and storing them into arrays for access. Whilst I create these MCs, I am also putting bitmaps inside them. When I access my MCs later, I wish to access these bitmaps too - but I cant seem to write the syntax to reference them.
Code:
//within my loop
mcs[i] = this['mc'+i];
[code].....
View 5 Replies
Nov 18, 2009
I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)
Code:
<root>
<dir name="images">
[code]....
View 2 Replies
Oct 5, 2009
There is a lot of code that I have but here is snippet to get to the point. I have created a Movicelip called via actionscript called "McButton". Then I created 10 MovieClips within that MovieClip ("McDot0", "mcDot1", etc). I need to know how to access mcButton.mcDot3 to change its color when button3 (mc already on stage) is clicked but can not figure it out.[code]...
View 2 Replies
Nov 16, 2010
How do access all of the children of a DisplayObject using code? (I'm looking for something like movieclip.children)
I'm using this in two cases:
1) To loop through and reposition all of the children of an enclosing MovieClip.
Or
2) To loop through and delete all of the children of a MovieClip
View 3 Replies
Sep 8, 2011
I am trying to create an image gallery :
<card>
<product catalog="Thread Works">
<name>AK E001</name>
[Code]....
I can access the attribute, but if i am selecting "Thread Works" i want only access <product catalog="Thread Works"> with children node , for additem to array collection
View 3 Replies
May 22, 2009
I've got a Flex 3 application with an HTTPService returning an Atom feed. I catch the result from it and store it in an arrayCollection which is then the provider of my Datagrid. I have no problem accessing the data from the "first-level" of my Array, but cannot go under it. Not very clear, so here is some code:
My XML [part of it]:
<entry>
<title>Test 2</title>
<id>http://collaboration.*****.com/collaboration/messaging/feeds/****/todo//7D6637D3E86B3ED3C12575B***8479</id>
<link rel="alternate" href="notes:///C12575B4004***8
[Code]....
The "title" column shows the data correctly, but the status column is empty ! When I launch my app in debug mode, I can see that my notesArray has the correct format and I can access todo -> status with the value..
View 3 Replies
Feb 20, 2009
Trying to parse the following XML:
Code:
private var pbStr:String = ( <![CDATA[
<phoneBook>
[code]....
View 2 Replies
Dec 28, 2009
I'm trying to load a SWF I created with Flash CS4 into Flash Builder with the SWFLoader class, but I can't seem to access the loaded SWF's children. Everytime I try to change the property of a child it'll ignore it.
I tried loading the SWF with the Loader class, but it doesn't allow me to add it to the stage. How can I load the SWF and access it's children?My code atm (m is a child of the loaded SWF (SWFToLoad)):
ActionScript Code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
[code]....
View 2 Replies
Mar 24, 2009
In this game attached I need the old Children (rats) to hurt the character when he walks into them, however only the most recently added Child is active in that way... also the rats seem to appear above the character instead of below, is there any way to resolve these issues??
View 4 Replies
Jan 11, 2010
I want to have a rollover effect of a movieclip (mo1) inside a movieclip (mo) of another movieclip (popup1).Is it possible to do that? I try calling it using this code in the frame 1 of my flash, am i doing wrongly?
Code:
popup1.mo.mo1.onRollOver = function() {
popup1.mo.mo1.gotoAndStop(2);
[code]......
View 9 Replies
Nov 19, 2010
Can I use the indexes of an array that is a child of another array?
View 2 Replies
Sep 23, 2006
Newbie to XML here and I have what I *hope* is an easy problem, but I just don't know the answer. And as I have to try and show this by Monday, I'm sort of stuck. I am trying to pull in information about houses via an xml file. Each house has 1 address, 1 owner, 1 description, and about 6 photos. I have no problem accessing the address, owner, etc, and I can always access the first photo, but whenever I cycle through the photos, I seem to cycle through the first photo for every house, not every photo for each house.
Basically, I need the children <images> to go up by one, without the the parent going up by 1. I am hoping I am describing this well. My code looks like this:
[Code]...
View 4 Replies
Jul 24, 2010
I am trying to pull in information about houses via an xmlfile. Each house has 1 address, 1 owner, 1 description, and about 6photos. I have no problem accessing the address, owner, etc, and Ican always access the first photo, but whenever I cycle through thephotos, I seem to cycle through the first photo for every house,not every photo for each house.Basically, I need the children <images> to go up byone, without the the parent going up by 1. I am hoping I amdescribing this well.My code looks like this:
total = xmlNode.childNodes.length;
totalb =
xmlNode.childNodes[0].childNodes[5].childNodes.length;
[code].....
View 1 Replies
Oct 28, 2011
I have an ArrayCollection that is read to generate containers in an accordion programmatically:
<s:ArrayCollection id="_ac_ps">
<fx:Object label="Block and lot" data="_blocklot" searchType="districtblocklot"
info="" />
[code].......
View 1 Replies
Jan 11, 2011
for some reason STORAGE[0].getChildAt(0) works whereas liner.getChildAt(0).getChildAt(0) does not. STORAGE is a movieclip and a child of liner. the error is something about not being able to use getChildAt on a display object. what's wrong? is there any other approach i could use? PS: liner.getChildAt(0) works and does indeed seem to refer to STORAGE[0]
View 2 Replies
Oct 20, 2010
It's too complicate to explain but I'll give you an example
I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?
View 2 Replies
Oct 22, 2010
So, you have a sprite, you draw some graphics, you set cacheasbitmap=true... I can't seem to access the newly created bitmap data, to access the dispose() method.
[Code]...
View 6 Replies
Feb 17, 2009
i have a little issue, this is the script:
import flash.net.navigateToURL;
import flash.net.URLRequest;
button.addEventListener(MouseEvent.CLICK, action);
function action(e:MouseEvent):void
{ var request:URLRequest = new URLRequest("novosti.php");
navigateToURL( request, "_self");
}
button is instance name of symbol - button, and like that script doesnot work there is error 1009:cannot access.....but when i put symbol with instance name button in form of movie clip, script works.
View 2 Replies
Nov 13, 2009
Is it possible for Flash or possibly Adobe AIR to have access to a local Access database?
I will have either a Flash EXE or AIR application running on a local PC (WinXP). The PC will also have a local Access database. I need my Flash application to get the data from this Access database. How would I do this?
I doubt it can be done with Flash or AIR alone (someone prove me wrong or right), but is there an option for some middle-man application to access the data base and send it on to Flash? How would this work?
Or could I read the MDB file into Flash and parse it myself? is there a library for this?
View 2 Replies
Jul 2, 2010
My flash movie loads config.xml from the file system. Inside config.xml are urls and the base url to other xml files that I wish to load in to the flash movie.
These urls in config.xml are requested by the flash movie providing my flash movie with data. Again these are .xml files how ever they are being accessed using the network. EG " http domain dot com slash data dot xml"(i cant post links yet)
I know that I cant access both network and local files in the same movie so my question is this. What is the best way to pass in the base url dynamically to the flash movie so i can cut out config.xml?
View 0 Replies
Jan 27, 2009
Well I have something like this:
<tests>
<test>1</test>
</tests>
[Code]....
Is there a way to make it add the child properly instead of botching the entry up like that?
Code:
var test:XML = new XML("<tests><test>1</test></tests>");
test.appendChild(new XML("<test>2</test>"));
trace(test);
View 1 Replies
Mar 18, 2010
I am creating a breakout game and below is a part of my code:
function updateGame(e:Event) {
if (ball_mc.hitTestObject(brickone_mc)) {
beepSound.play();
yVel*=-1;
removeChild(brickone_mc);
[Code]...
I have got it removing the bricks as each brick has an instance name, I am now wanting to go to an end screen once all the bricks have been removed, is there a way to count the children and then put a gotoAndStop() in?
View 1 Replies
Nov 10, 2009
ok, my Digital arts class is making a flash project, and im like the only one actually making a game, so im pretty much alone. i got a lot of help from the people on the AS3 forum, but im pretty sure that my question is too easy to put there. so, i have an array, and it basicly puts a spike on the screen at a random Y, and moves it across the screen, but, when i hit a spike, and ti goes to the you lose screen, the loop keeps adding children, and putting them on the screen, is it possible to just say stop adding children, and go to the next frame? i have a break, but when i stop colliding with the spike in the next frame, the spikes start coming again. also, can i totally reset the movie? cause when i just go to frame 1, the array plays itself ontop of itself and it gets twice as hard
View 2 Replies
Nov 27, 2009
I'm getting a list of movieclips with attached scripts to display, but when I try to put them on the sceen nothing shows up.I can trace the elements in the list and it will tell me there are elements there.I can trace getChildAt(numChildren -1) and it will tell me there is something there but nothing is visible.If I generate the list in the constructor of the class that handles the displaying it does show them, but when I try to load them when they are actually needed they don't show up.Here's a simplification of the code(its a small part of a larger project and I can't put all of it up somewhere public)This code does what it should do(unfortunately that is not what I need done)
Code:
package foo.bar
{
import flash.display.MovieClip;
import flash.display.DisplayObjectContainer;
[code]...
The traces all show up so I know its running the method, the traces tell me it adds stuff the the screen, but what I see on the screen remains completely stagnant, as if nothing is being added.
View 2 Replies
Mar 12, 2010
adding all the bricks of another movie clip into an array in my controlling mc (GameScreen). Except, when I try to remove them from the display list by accessing them from their array, I get
Quote:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller at flash.display:isplayObjectContainer/removeChild()...and so on
I'm guessing it's something to do with adding another movie clip's children into an array in a movieclip that isn't the stored clips' direct parent, but it's parent's parent.
Code:
private function checkBrickHit():void{
for(var i:int=0;i<brickArray.length;i++){
[code]....
View 3 Replies