Actionscript 3 :: Combining GetChildAt With AddChild?
Jan 8, 2011
i have the following code:
seatContainer.getChildAt(order.seats[i])
i want to add a child to this but it doesnt allow me, i can only add an eventListener to this.
how i can add a child to this without using an eventListener?
View 1 Replies
Similar Posts:
Nov 9, 2009
I've got a question that might make me look like a fool. But the question is:Is it possible to somehow change a dynamic variable or call a dynamic function of an object using
Code:container.getChildAt(index).variable = 234;container.getChildAt(index).function();I mean, if I write a class with some functions and variables that are public. And I need many instances of that class (which extends MovieClip, and is tied to a object in the library) inside the container object. and I want to run some functions and set some variables of the first object in the container object when the
[Code]...
View 1 Replies
Apr 15, 2012
From a position on an Array of sector Sprites on an 11 x 11 grid, I am trying to "sense" what Child occurs at nearby sector Sprites. I felt certain I could use something like this
if (sectorArray [currentSector - 11].getChildAt is MovieClip) {
//do stuff
}
but it doesn't seem to work. I changed my visibility settings to true, thinking the false visibility might be a problem, but no result.
View 9 Replies
May 29, 2011
I know this may seem like a trivial question, but I don't know how to solve this, basicly I remove certain components from my stage at a part of my Flash/Actionscript 3 movie by running through all the elements displayed, seeing if each is an instance of MenuDinamico (sprite), GalerĂa (sprite) or Map (Google Maps)
[Code]...
View 7 Replies
Mar 16, 2011
I am trying to drag and drop the bitmap by using getChildAt() but it doesnt work,
View 2 Replies
Jan 14, 2010
I am trying to get an image object from one sprite container and adding it to another sprite container. But when I use GetChildAt for this, it will remove the object from the parent sprite and place it inside the other.
Code: sprContainer1.addChildAt(sprContainer2.getChildAt( 1),0);
Problem is when I run this code sprContainer2.numChildren is getting reduced by 1, which seems that this code removes a child from sprcontainer2.
View 2 Replies
Jun 7, 2010
I am getting error while I set text property through getChildAt method.My code is given below
HTML Code:
import flash.display.Sprite;
import flash.text.TextField;
var answer:Array=new Array();
[Code].....
View 2 Replies
May 16, 2011
In the platform game I'm making, I have a movieclip level/stage with the platforms (which are there own class) added in. I'm trying to load those platforms into an array for future use, but as I keep on getting null. Take a look at the code:
package
{
public class StageLevel1Test extends StageManager
{
private var _platformListCntr:Number = 0;
[code]...
View 2 Replies
Jan 9, 2010
I am trying to get an image object from one sprite container and adding it to another sprite container. But when I use GetChildAt for this, it will remove the object from the parent sprite and place it inside the other.
Code:
sprContainer1.addChildAt(sprContainer2.getChildAt( 1),0);
Problem is when I run this code sprContainer2.numChildren is getting reduced by 1, which seems that this code removes a child from sprcontainer2.
View 2 Replies
Aug 24, 2009
I know I am missing something simple here. Why does
[Code]....
View 3 Replies
Jun 30, 2011
I am fighting against this: I have a script inside a movieclip. There are a few children, too. Each child contains other movieclip whose instance name is "masker" and a button. The script reads:
[Code]...
View 3 Replies
Jun 15, 2011
I'm trying to have a class file which can add objects to the stage via addChild; however, when I call addChild from within the class file, I get the error "1180: Call to a possibly undefined method addChild." I've tried importing flash.display.* and that doesn't fix the problem. Does the class file have to extend Sprite or MovieClip to be able to add objects to the stage?
View 8 Replies
Jan 16, 2012
I have downloaded Box2d ([URL]) and created a project that looks like this: [URL]. catalyst is the green cube and it has the base class "shapes.box", it is inside "world" which has the base class "wck.World". What i want to do is to add another "catalyst" from the library inside "world" when i click on add_btn. I tried to accomplish this by this code:
[Code]...
Symbol 'buttons', Layer 'Actions', Frame 1, Line 41061: Call to a possibly undefined method addChild through a reference with static type Class.
View 9 Replies
Jan 20, 2011
I have the followings:
_p:Player (which is a MC)
a1:Animation1 (which is a MC)
_p.addChild(a1); //doesn't display anything
_p.stage.addChild(a1); //displays a1
Why won't the MC display a child without using his stage?
View 1 Replies
Aug 11, 2009
I'm trying to resolve an issue that reared it's ugly head yesterday.Frame one of main timeline I have the following code:
Code:
import flash.display.MovieClip;
import flash.events.MouseEvent;
[code]....
The newMC doesn't show up.If I add 'parent.' in front of the addChild then it appears.mc_LibItem has a base class of "flash.display.MovieClip" and is exporting for ActionScript and on frame one.For grins I created a new .fla and began messing around with the same addChild idea and it worked.
View 14 Replies
Oct 30, 2005
somewhat understood the basics of adding and removing children, however, I am facing another problem. After using the removeChild Function, I can't seem to add another child.For example:
ActionScript Code:
var attachedMC = new (getDefinitionByName("Content1") as Class)()
Page.addChild(attachedMC);
[code].....
View 3 Replies
Jul 29, 2009
I have a main "shell" swf which, by clicking several buttons, will load/unload various external swfs into a Placeholder_mc which resides on the main timeline in Shell.swf In the documentation and tutorials I've seen a couple different methods, and I'm not sure I quite understand the difference, or at least the reason you would use one over the other...In the 1st method, you can just add the Loader object using the addChild() method:
Code:
var myLoader:Loader = new Loader();
var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf");
myLoader.load(myURLRequest);
Placeholder_mc.addChild(myLoader);
This will apparently add myLoader to the display list once it has completely loaded.The 2nd method, you supposedly can add the Loader.content; however, it appears you can only do this once the content has completed loading, so you need to incorporate an event handler with the contentLoaderInfo object:
Code:
var myLoader:Loader = new Loader();
var myURLRequest:URLRequest = new URLRequest("ExternalFileA.swf");
myLoader.load(myURLRequest);
[code]....
What are the pros/cons of adding the entire Loader object, as opposed to the Loader.content and vice versa?
View 7 Replies
Jun 30, 2009
I'm making a website which consists of an intro and the main page. For all intensive purposes, let's just call em intro.fla and main.fla.I would like to combine the two somehow
1) Turn the entire intro.fla into a movieclip and place it at the beginning of main.fla PROBLEM: main.fla is substantially larger, and will bump up the load time for the intro.
2) Run the intro, and have it load the main page with a UILoader.PROBLEM: The intro doesn't Unload, causing problems with the main page. How can I unload the intro.swf from it's self?
3) Somehow combine both .fla's before I convert to a .swf. I think that I could eventually figure out how to make it work properly, but I'd rather someone tell me what the preferred method is and why.
View 1 Replies
Jun 4, 2010
I have three different fla/swf files, and I wish to compile them into one fla/swf for easy viewing.The problem is that they each have a different frame rate.
View 2 Replies
Jun 8, 2009
So here's what I want to do: I have a button, and I'm adding an Event Listener to that button to call a function. Now I want the event to be triggers when someone mouses out of the button AND someone is mousing out in the direction up.
-carbotech_button.addEventListener(MouseEvent.MOUSE_OUT, callLink); <--- does the job for Mouse Out
-carbotech_button.addEventListener(MouseEvent.MOUSE_UP, callLink); <---- does the job for when the mouse is moving up
So I need to make it so that both of these end up true in order for function callLink to be called. Is that possible, and if so, what would the syntax be?
View 2 Replies
Jan 5, 2011
I tried to combine two of Tony's great tuts.URL...I'm not sure what I did wrong so if you guys could have a crack at these and try to combine these.
View 2 Replies
Sep 13, 2009
Using AS3 code, is it possible to combine 2 graphics or more into one?
Example : combining a rectangle and a triangle to make a nice arrow?
View 5 Replies
Sep 8, 2011
i have a few onEnterFrame functions like 6 to 7 which I want to combine them into a single function. But it doesn't work after adding the function.
View 4 Replies
Apr 11, 2012
I have tried on google with no luck so before I spend anymore time on this would like to know if it's possible.I have 50ish very small 1 - 2 second swf files each one is like one slide. I would like to combine them all together into one flash file.Is this possible, as a note I don't have the original source files I have just been provided with the swf files.
View 3 Replies
Nov 5, 2009
1) I started off with one FLA that was scripted so the mouse controlled panning (horizontal and vertical). That works fine by itself. (image_panning_as3.fla)
2) I also have another FLA that was scripted so when you click the buttons a popup window will come in and play any SWF content. (test.fla)
I have tried to combine these files multiples ways. Putting #2 into a movieclip and #1 outside the movieclip. Tried to rewrite everything together with no luck. I am trying to do is combine the AS3 into one FLA (except for the main.as) or basically get the AS3 in #1 to go into #2 and have everything work (Pan around screen with mouse and buttons still activate popup).
View 1 Replies
Apr 13, 2009
I created several SWF files, now i want them to interact with each other So there is main SWF file lets call it: main.swf then within that file(main.swf) I would like to create buttons which will be calling other swf files for instance by pressing one button one.swf will be open by pressing other button two.swf will be open and so on. Then I would like to create buttons within one.swf and two.swf which will allowed to go back to main.swf.
View 3 Replies
Oct 13, 2009
I am very new to AS and I'm just starting to grasp the essentials of how things are working... but I haven't got to the point to where I can write my own from scratch, so I kind of have to "Frankenstein" different examples into a working project. I found a great XML slideshow demo that I want to overlay with a masking effect, but I'm having some difficulty combining the techniques.
At the bottom is my original slideshow code. If there's anyone that can modify my code or at least guide me to what I need to do to make it work,
[Code]...
View 0 Replies
Apr 25, 2010
combine the following from Senoculars classes:
Transform.as - transform handles to rotate an mc
DashedLine.as - to draw a dashed line
ProgressiveDrawing.as - to move an mc from a - b
(Links at bottom)
I am basically trying to drag a mc onto stage. Rotate it using rotation handles, move it to another position and rotate it again. Then press play to watch it move from a - b, with a dashed line, and rotating from a - b.
Has anyone done this before or know of examples?
Senocular has combined DashedLine and ProgressiveDrawing in this example: [URL] and its been really great but now I am stuck trying to make the mc rotate. I have made my own crappy rotation handles but thought it may be better to use the transform (and convert somehow to as2) and store each rotation.
[URL]
View 0 Replies
Aug 12, 2005
I have two movies. The first one has a button that, when clicked on, loads the second movie using loadMovieNum. I'm want to be able to jump to a specific frame (i.e. 177) in the second movie when I click the button in the first movie. I'm using the script below to load the second movie: But it don't really work.
[Code]....
View 2 Replies
Oct 21, 2005
I've successfully loaded my xml and created three arrays to hold the news article date, title and text, using the following code:
HTML Code:
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success) {
[code]....
How do I firstly get my arrays into a textfield with the format date,<br> title,<br> story, and secondly how do I deal with that horrible datestamp to make a recognisable uk date?
View 1 Replies