Rather than change existing XML data, how do I add completely new data? ie, if the above var held two "mediaFile" lines of XML, how do I add or insert a third?
I am able to add key/pair data into the associative arrays, like;
Code: var arrColors: Array = new Array(); arrColors.push({color: "aqua", code: "0x00FFFF"}); arrColors.push({color: "beige", code: "0xF5F5DC"}); arrColors.push({color: "brown", code: "0xA52A2A"}); // and so on
But, if I want to do the same with the array of generic objects, like;
Code: var obj: Object = new Object(); obj["key"] = "value";
How can I add more data into it, because push() function does not seem working with this type of array.
I seek correction and guidancem from you experts, on the Associative arrays and the arrays of Generic Objects. I created the following working code and I believe it is an Associative array:
Code: var arrColors: Array = new Array(); arrColors.push({color: "aqua", code: "0x00FFFF"}); arrColors.push({color: "beige", code: "0xF5F5DC"}); arrColors.push({color: "brown", code: "0xA52A2A"}); // and so on
Now, I want to create an array of Generic Objects for the same items, as below:
I'm making a banner rotator that reads image urls from an xml file and adds them to a sprite on the stage, then tweens them into position. Here's the relevant code:
Say I have a flash project, with 3 layers (a, b, c). Layer C is the background, and A has a couple of shapes that masks B. Now I'm just wondering if there's a way to add my objects (MovieClips) to the stage using AS3 and still maintain the masks coming from A, seeing as merely putting my code in Layer B doesn't do the trick
I am using gaia with a fluid layout at here is what I get: This is the error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.gaiaframework.FluidLayout::FluidObject/reposition() at com.gaiaframework.FluidLayout::FluidObject() at pages::MemberPage()
Here is my MemberPage code: package pages{ import com.gaiaframework.templates.AbstractPage; import com.gaiaframework.events.*; import com.gaiaframework.debug.*; import com.gaiaframework.api.*; [Code] .....
Note there may be some extra classes and imports etc. I was trying a bunch of things. The full fluid layout tutorial I followed is here: [URL].
I am new with ActionScript but not entirely new to programming so I haven't had many problems with it.However I am trying to make a slideshow like slide.com's. I have 3 layers:Actionscript Preloader Images
This is the ActionScript in the Images layer:
[Code]...
On the stage there is 20 pixels before the thumbnails are supposed to be layed out, so I have tried to accommodate this. So the objects I want to create are the thumbnails. My problem is they are not showing up, and I have a valid image URL in the XML. Can anyone tell me how I would fix this? How do I do this in AS3?
I need to find out how i can add those same movie clips on the main timeline with code..So i need to figure out how to take objects from the library and add them on stage (main timeline) using code..
i'm currently using a dictionary to associate a boolean to my (non-dynamic) sprites, but i would like to know if there is a smarter way of doing this? i could just use MovieClips to assign my properties instead of Sprites since MovieClips are dynamic, but i will not be using any of the MovieClip properties or functions so it comes down to a best practice issue. basically i want to create a state boolean property on my sprites - they are either on or off so my boolean variable is called isOn.
I'm trying to make annotations on an image. I want to store all these annotations into a collection so that I can later remove or edit particular note(annotation).I'm creating a UIComponent instance for example markUp and doing
I have is as I add objects from other classes to the stage, is there a way to automatically add them to the resize event I have on the main stage to keep them in position in my fluid flash layout? Currently I am declaring all the variables in the project at the top of my primary class, adding them to the stage in the opening function, and then finally adding them to the resize event.
I am trying to create a card game (deck of 24 cards/6 cards will be dealt to the stage at one time (3 arrays)).
I want 6 cards to be dealt to the stage when you click the "Deal" button. I think i have the loop set up properly, the first array traces, however i can't get the cards to be added to the stage. What am i doing wrong? Once i get the first set of cards to be built to the stage, i will want to remove the previous set and the second set will be dealt to the stage once the "Deal" button is clicked again.
//code var aArray = new Array(); aArray[0]=Card1; aArray[1]=Card2;
I am a flash developer and I've got some experience in games and applications, but there is a problem that always comes back and that I solve in sometimes discussing manners, but I've decided to find the "good way" of doing it.Ok, here's my problem :I have a game where I set the publish setting to export in Frame 10. Most of the graphic content is already on the stage on the frame 10, but there are a few MovieClips that I add and remove using AS from the stage (a "How To Play" movieclip, for example).All the movieclips I want to use with AS are set to export in Frame 10 and are used in different custom classes.Everything works just fine if I set everything to export on Frame 1 and all my graphics are on frame 10, but not if I export in any other frame than 1.The workaround I've found is to create an instance of the objects I want to load outside of the stage, but I hate that way of doing things :I get no error if I create an instance of my movieclips through AS, but they won't show up when added to the display list (yes, I know how to use addChild )
I'm having one of those moments where I can't figuring out the simplest of tasks. And I'm presuming it's just a silly syntax error on my part. I'm calling a class that handles a nice lightning effect. And this is how I would initially set that up:
My AS3 application basically does the following (pseudo code from main application class) 3 or 4 times by adding custom objects to stage:
_movieClipClassVariable = new MyCustomSpriteSubclass(); _movieClipClassVariable.addEventListener(MyEvents.READY, function(event:Event):void { _hideLoading(); mcHolder.addChild(_movieClipClassVariable);}); _movieClipClassVariable.addEventListener(MouseEvent.CLICK, myClickHandler); private function coverClickHandler(event:Event):void { }
What is the right way to allow Garbage Collector to recycle _movieClipClassVariable after it is not necessary? Assign null to it? Remove all listeners? Use weak reference for listeners?
I'm trying to think of the best way to add event listeners(mouse events) to an invisible object which is quite large. A straight forward way I can think of is probably setting the object's alphy property to 0. However since that object is very large, it will probably have a huge impact in performance. Setting invisible to flash however, will stop it listening to events.
e.g. I have a massive area 4000x4000, but I only want the 2000x2000 area to listen to events.
Other methods I can think of is to have the smaller area in the layer below the big area, covering it from view, though I'm not sure if the lower layer can pick up events? another way is maybe just have the big area listen to events, but in the handler I'll write some code to check if its within the boundary of the smaller area.
I'm having trouble with my code. I keep getting this error TypeError: Error #1009: Cannot access a property or method of a null object reference. at Test_fla::MainTimeline/frame1() I believe it has something to do with the array, considering it works when I remove the array stuff. What I'm trying to do is to be able to move objects through an array with my gravitate() function in the Grav Class.
stage.addEventListener(Event.ENTER_FRAME,onLoop, false, 0, true); for(var i:uint=0; i < numParticles; i++){ var p:Grav = new Grav(5, 0xff0000, Math.random()*250, Math.random()*250); addChild(p); particles.push(p); } function onLoop(evt:Event):void { //for(var i:uint=0; i < numParticles; i++){ //particles[i].gravitate(1,1); //}}
So a small example of my situation...On my stage I have 5 items labeled item1_mc, item2_mc, item3_mc and so forth...they all have two keyframes on their respective timelines, one labeled "active" and the other "inactive". My code contains 2 arrays, inactiveArray and activeArray and a variable known as energy that regularly goes to and from 0 - 100.
What I am looking to achieve is basically the function of...
if energy >= "insert given items 'active threshold' 20, 40, 60, etc..." then add it to the activeArray, if it is not, remove it and add it to the inactive array.
all objects in activeArray gotoAndStop("active");
all objects in inactiveArray gotoAndStop("inactive");
I have tried many different ways of achieving this effect but I always end up with duplicates and extras or something doesn't move when it's supposed to, where it's supposed to, it just ends up into a giant cluttered mess and I start from scratch.
I want to make a little game. What I need is to add event listeners to all of Tank objects inside the Battlefield instance. I just can seem to figure out how.
I know it is possible to make instances/children interact with other objects by adding an eventListener to each child/instance.But how do you make a random instance/child interact with another random instance/child?Example: let a bunch of spaceships get damaged by a bulletrain by using addChild to place both spaceships and bullets on the stage.
Code: var myArrow:ArrowMovieClip = new ArrowMovieClip(); var vectorDisplayObject:DisplayObject = stage.addChild( myArrow );
I used the code above to create an instance of an arrow graphic that I made using the line tool (the graphic is embedded in a movie clip). I now want to add different colored fills and different stroke sizes and colors using code. Is it possible to do this with pre-drawn vector graphic objects, or is it only doable if I create the arrow with code using things like lineTo and curveTo?
I have a flash banner rotator that runs using PHP at the backend. The way in which the flash banner is called into the script is by using the following PHP:
I'm making a login script and adding the data to my local mysql database using php.it works as long as I browse in my browser to localhost/ flash/ movie.swf but if I just open the folder and run the .swf file it doesnt work
I am working on an online poker game for a client. I am in charge of the design phase and somebody else is involved with the back end. He sent me an group of API formated to fit in to Action Script. I am not sure how to proceed. What would you need from me on this post to see what is going on?
and E4X to pull in an XML file. I am wishing to display some text as subscipt. E.G with G2, the 2 would be subscripted.if this can be done and if so how?
var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
[Code]...
This loads the xml, assigns it to bookInput and traces it, but when I try and trace bookInput.project, or bookInput.button, or anything besides bookInput, no data is returned,