Anyone know how to access a var name dynamically with an object? I need to be able to get myObject.objValue1. But I want to go through a whole bunch of them in a for loop from value 1 to 50.
I have stored name of a property of an object as a string. In PHP, if the object were named $object and the property variable was named $key, it could be accessed with $object->$key. How can I dynamically access properties in ActionScript?
I had created a loader which can load an array of images. However, when there are more images, the images actually got hidden as the size of the application is too small to accommodate all the images. I would need to create a scroll bar. I tried creating a scroll bar but there were errors faced saying that "TypeError: Error #1009: Cannot access a property or method of a null object reference.". I am not really sure on how to do it,
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?
I am developing an application with Flex for the GUI and Restlet for the webservices. I have a strange problem. I put my XML as a property on a generic object, and send it as part of a POST request. But in the Restlet webservice, this XML is irretrievable. How do I retrieve it? I tried initialising the received Representation object to a DomRepresentation, but thats not working. If I put the received Representation object into a Form object, then getFirstValue is returning that XML as a string! I noticed that the contentType of the HTTPService was application/www-form-encoded so I set it to application/xml and its not helping either. I use restlet 2.0m6 and here is the code snippet that I use -
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?