ActionScript 3.0 :: Use An Array To Manage Multiple Hits?
Sep 12, 2010
I been trying to get a remove child function to it seems to work sometimes at least according to the output window. But the majority of times when ghost hits a flame the flame doesn't disappear.
I have used AS2 for a long time, and have decided it is time to start working with AS3. When attaching multiple movieclips with instance names I would normally do this (AS2)[code]...
I have a custom Image class that I am using to store individual image information for a gallery application:
package mtm.test { public class Image extends Object {
[Code]....
This is how I would implement the above:
var image:Image = new Image(); //I would be loading external bitmaps but for the example I'll just create new ones: image[BitmapThumbnail] = new BitmapThumbnail(new BitmapData(65,65,false,0x000000));
[Code]....
Is there a simpler way to do this? I feel that there is a lot of repeated code within the BitmapType sub-classes.
At the least, this helps to avoid a bunch of for loops trying to find the requested size, and it seems portable to situations where more or less sizes of Bitmaps are required.
EDIT: attention i make a mistake explaining my situation, chek my post #4 Like we know to manage the depth of an elment placed on the stage and bring it on foreground, we can write
setChildIndex(myMC, numChildren-1)
Now my situation is little different. I've a stage populated only by an array that contain *n* MovieClip inside it then the last MovieClip i've pushed inside it is obiuvsly the element with the hightest children number, then, it's result on foreground. If i want to bring the MovieClip cointained into myarray[1] on foreground, what i can write?
I have an array of movie clips, and I want to be able to control their visibility(make them invisible to start). The array is called allCoffees, I tried:Code:_root.allCoffees.visible=false;That did not work, so I tried looping through the array to do it:
Code: for (i=0; i<allCoffees.length-1; i++){ _root.allCoffees[i].visible=false;
I'm trying to set up a preload system that can load multiple XML files and manage an overall progress bar but got immediately screwed by ProgressEvents not bubbling. My basic code set up is: Document Class
So document class up an array of xml paths and passes that to the XMLManager, that then iterates through the array and creates a new XMLloader for each path and stores those XMLloaders in another array. The XMLloader goes off and creates an URLLoader that loads the XML. It has listeners for Event.Complete, IOErrorEvent.IO_ERROR and ProgressEvent.PROGRESS which is fine.
I'm getting the correct progress data in my progress handler but what I want to do is broadcast that progress data straight back up to the Document Class which I had thought would be where dispatchEvent would come in by doing something like this in the XMLloader class:
The Setup: For each movieclip the hittests a set of "target" movieclips an array is given a value. If mcIcon1 is dropped onto mcTarget1 the first number in the vacant array is given the value of one. The Issue: If I remove mcIcon1, for example, from the mcTarget1 movieclip I can't find a way of just removing the 1 from that array without the rest of the array numbers being reset.
I'm making a small adventure game, and I want the game to go to the next frame once the main guy MC hits another invisible mc, like where the door is. I suppose another way of doing this is when the main guy mc hits an xy coordinate. So basically what I want is a script that says, when MainguyMC hit another MC/ coordinate, go to frame 2
Just want to put the thumbnails in a movie clip.Not any thumbs are appearing, there is a mc on stage, there are images and thumbs, there is a xml_file�
Code: var gallery_xml = new XML(); gallery_xml.ignoreWhite = true; gallery_xml.onLoad = function(ok) {[code]...
I have two movieclips A and B when the movieclip A hits the movieclip B , I want the movieclip A to be removed what code should i write for this flash problem ?
I want it to remove everyone that it hits, but it only removes the first one that hits. I am sure the answer is simple, but i am slow. Here is the code:
ActionScript Code: function removeSpawn(){ for(j=0;j<lvl1A;j++){
I have 2 movie clips with a linkage. In a process both mc's are being attached lots of times and a new name is given to each every time.I want to make it so that is these 2 mc's hits each other they dissappear, but i can't do that because they all have different names and i don't know how to call to them.
Is there a way to keep track when an FLV hits a certain point in its playback WITHOUT using cue points? If so, how is this implemented and does it make the experience sluggish?
I have got a handle on the logic of arrays (just), but the syntax is doing my head in. I'm trying to tween six mc's with the one single action.ugliness of the following misbegotten code I am failing with:
I have a very big proyect completelly developed in FLASX MX PROFESSIONAL 2004. In order to manage it,I have divided the file in several parts. What I want to do now is to connect that parts and compile them as a Whole.
I have swf file containing a game with english language. for question sake will call it mygame.swfNow what I want to do, is to take the fla file and translate it to french and german and save to differen swf files.So now i have:English - mygame.swfFrench - ygame_fr.swfGerman - mygame_gr.swfSame game, different language.My question is: what is the acceptible / good way to contain text in fla file so it will be in one place? like hashtable or some array?I am developer, just not flash developer this is why Im trying to consoult Im not interested in keeping data in external files (xml), I want everything to be keept within swf.
I'm working on an AS3 project that must load a lot of external files; images, sound clips, movie clips etc. The program first loads an XML file that contains the file names of all assets needed by each class. From that point on I'm not sure what would be the best way to distribute those assets.I thought about making a dedicated assets class that will load everything the XML object describes, and then pass it to each class' constructor so they can access the objects they need. This seems like the "tidiest" option, but is there a best practice way for managing loaded assets?
PURE MVC - In my application there are multiple screens which are minimized like in windows desktop. Now each has different instances of mediator which have same notification. So if I do changes in one screen say press some button >> which sends some command >> to proxy >>then proxy sends notifications to mediator. But as multiple screens are active there it is showing changes in all screens as they are notified too by proxies. How to make sure that proxy calls to particular view component (mediator) and not for all live instances of mediators ?
I wrot a FLA in AS3 which is basicaly a nicly designed Loader which loads little cute SWF games. Each game is built a bit differently and has its own 'thing'.I was wondering, how can I control the sound of the SWF's from the Loader File?
Which leads me to a wider issue of how can I control variables of a loaded SWF.
I'm trying to contol the amount of time that a video plays, using netstream. I need to have the stream stop or pause after a amount of time... Here is the code...
var flvPlayback:FLVPlayback = new FLVPlayback(); var flvPlayback1:FLVPlayback = new FLVPlayback(); var cuePt:Object = new Object(); //create cue point object
I have a simple test for how I want a game im making to work. A movie clip is placed on the stage, upon which I want it to start floating to the top of the screen according to given x and y coordinates. But I cannot manage to get the clip to move.
I would like to know how to manage timing in AS3.Let say I have some functions in a code and all of them trigger an animation.
A) I would like to run the functions one by one, but next function must not be triggered before the animation of the previous one is completed
B) I would like to run the functions one by one, but next function must be triggered certain time after the animation of the previous one is completed.