is it possible to create instance inside method of another instance? But I want new instance to be sibling of instance where it was created.something like this:
ActionScript Code: parent = new Parent(); childA = new Child(); parent.addChild(childA);
Child class would have this onclick event function:
ActionScript Code: public function child_click(e:MouseEvent):void { childB = new Child(); }
I want "childB" to be child of "parent", no property of childA. so I could do:
ActionScript Code: parent.addChild(childB);
how is this possible without passing "parent" instance as parameter?
I'm trying to dynamically addChild a Sprite to an already tweened MovieClip (tweened on the Flash timeline). Let's say ObjectA is the tweened object, I published it in my swc and linked it to my Actionscript project in Flash Builder. I make an instance of ObjectA in my class, and then try to do the following:
var objectA:ObjectA = new ObjectA(); var objectB:ObjectB = new ObjectB(); objectA.addChild(objectB); addChild(objectA);
Now, the problem is, objectB doesn't tween along with objectA. Is there any logical solution to this?
how would I make Flash create a jpg or png file of what was currently on screen dynamically? I would like to know how to go about doing this and I'm sure it probably involves some other scripting language (PHP?) also.
My game is initialized by calling the newBall function below. Every 10 seconds a new ball is created to increase the difficulty by calling the same function. The function works and creates the new ball movie clip, however the previous ball object gets destroyed for some reason. I have an array called ballArr that is supposed to keep track of all of the ball movie clips. I thought that by concatenating the name of the instance with an incrementing number that it wouldn't overwrite the existing object... what am I doing wrong?
Code: function newBall() { var ballNum = ballArr.length + 1; var ball = this.attachMovie("ball_mc", "i" + string(ballNum), 0, {
I would like to be able to create and call an Array dynamically. So to pass a name through a function and create an array based on that name.Then to store values into sections in the array. I got the creating the array dynamically working, but I can't seem to store into it.
Code: Sort = function (numOfVars,Name,toSort){ This works _global[Name] = New Array(New Array (),New Array()); This does not work _global[Name][i][c]= 3 This does not work _global[Name + "[i][c]"]= 3 This does not work _global[[Name][i][c]]= 3 }
I have two MCs classesThe first one is put on the stage. Then, from the first MC class (inside the class), i put another MC. So i created a MC inside the first MC.I can see both MC when i test my movie.I put the second MC when the mouse cursor is over the first MC, and i remove it when the mouse cursor is out the first MC.My problem is that when the mouse cursor is over the second MC, the movie behaves like the mouse cursor goes out of the first MC, so the second MC is removed, so i can't click on it.
Version: Flash CS4, AS3 is it possible to turn a given sprite into a Class with a given string as its name? The resulting class should then be available under that name in the current domain's definitions.ie.
createClass(someSprite, "someName"); .... var someClass:Class = getDefinitionByName("someName") as Class;
I have a XML and it has an attribute option or combo box, parsing that i need to create components in my flex dynamically. Viatropos has given a wonderful code, but i am not able to execute it... can anyone produce it.
take an arbitrary variable, and create that number of timers, with a corresponding number of listeners? And then write a function to deal with the listeners?
I want to make a site for my personal gallery and i'm asking you if there is another method to make my gallery, other that the one when the user click Back and Next to navigate through thhe images in the order that i chose. I want to create some buttons dynamically (so i will be able to add images to the gallery without replacing the SWF) and assign each of these buttons an on(release) or on(press) event handler that will show the image for that button
Im creating many textfields dynamically and I dont want to have to repeat the same code over and over for each field. Currently I have something like below which deosnt work.
I'm using Flash CS3, Actionscript 2.0 and I'm trying to create buttons dynamically.I tried to follow the code in the link below. The code is correct for the most part but the only problem I have is that only the last button appears. For example, if I try to create 10 buttons, only the 10th button is created.
I've been trying to create a scrollpane dynamically but I keep getting a bunch of errors when I publish the swf. At first I thought maybe there was a problem with my code so then I looked in the file and copied and pasted one of there examples into a blank fla and I still get the same errors when I publish. If I look at what is the source of the errors it looks like the error originates at this section of the ScrollPane.as file:
Code: override protected function drawBackground():void { var bg:DisplayObject = background;
how would i go about dynamically making a function... im making a Tile Based World level editor and when the user is done editing a level, then they hit a button and a couple of for loops runs through all the tiles checking the x,y and tile type. then i want thisinformation to be parameters within sub functions within the main function. so the as would look something like this
I'm creating buttons dynamically, but I want to add code also. something like (psuedo)[thumb + i].on Release = "_parent.thumb" + i + "Pressed()" can that work? I think I need targetMc?
I need to create a circle dynamically in as 2.0, i.e., when i drag the mouse downwards the circle should get bigger and when i drag the mouse upwards the circle should reduce smaller according to the radius of the circle it should resize.
Are there any built in utilities for playing/creating MIDI style music in AS3?I'm not looking for something that will play .mid files, but something that will be able to play a "Middle C " tone, either as a piano tone, or as a cheap computer tone.
So I have this loop generating buttons based upon how many entries there are in my XML:
Code: for (j=0; j < base.image.length(); j++) { trace(j); var newButton:imgButton = new imgButton();
[Code]....
Now I'm just wondering what the best way of assigning control to the buttons is (i.e. making them do something,). I'm wanting each created button to load a different image (defined in the xml) if that's of any use.
Do I need to add event listeners dynamically or something?
Is there any way to create dynamic animations? Say if I'm creating a game and there might be multiple sprite sheets for different NPC's, would I have to manually create the walking/whatever other animations manually?
I'm currently working on a project where I need to create a grid of dynamic text boxes each displaying my specified number. I won't go into big specifics, since I can assign the values to each text box, but for some reason I'm having problems creating the grid dynamically. I've used the same method for attaching Movie Clips in a grid, and it works fine, so I can't figure out for the life of me what the problem is.
I want to make a site for my personal gallery and i'm asking you if there is another method to make my gallery, other that the one when the user click Back and Next to navigate through thhe images in the order that i chose. I want to create some buttons dynamically (so i will be able to add images to the gallery without replacing the SWF) and assign each of these buttons an on(release) or on(press) event handler
I have an app that lets you upload a photo and mask part of it. I want now to press a button that takes a screengrab of the flash player and saves it to the server.I'm aware this will require scripting to talk to the server but for the flash part of taking a I've even considered using fscommand to somehow access the printscreen function but don't think this will work after checking the documentation.