ActionScript 3.0 :: Add Particles From An Array Inside To A MovieClip
Feb 11, 2010
ActionScript Code:
var myArray:Array = new Array();
for(var i=0; i<10; i++){
var p:Particle = new Particle();
[Code]....
I have this array of particles and I was wondering how can I add this particles inside a movieClip, in other words I would like to add particle "p" to a movieClip that I have on the stage with an instance name of "mainMC".
Also, is it possible to display the number of particles (p) inside mainMC in a text field? On this case I know it will be 10, but this will change.
I have a snow globe image on the stage and a movie clip that surrounds the inside of the globe called area_mc. I need my snowflakes to only float around in area_mc (my snow globe). Right Now I have all my flakes floating around the entire stage.[code]...
I made a particle class following a tutorial a while ago. Basically it uses some sort of a virtual list, replacing the array method, which makes it really fast solution. So everything is working perfectly fine except the fact that i really can't understand what actually is going on. It is pretty confusing so im trying to find the logic in this stuff, unfortunately with no success.[code]
i have dynamic buttons in movieclip and i want the movieclip goto 2nd frame once some one click single movieclip while rest remains in 1st frame.the movieclips can be in arrayi have some code here:
Actionscript Code: var mc:MovieClip = new MovieClip();for(var i:int = 0 ; i < numberOfButtons;i++){ var btn:MovieClip = new button();
How can I target a movieclip that is inside each item in the array using getChildByName. Heres my code so far: var aMC:Array=new Array(letter, envelope, parcel); if(i< aMC.length){ var myTargetName:String = aMC[i].target.name; var myTarget:DisplayObject = getChildByName(myTargetName); trace("Stamps Target: "+myTargetName); if (evt.target.dropTarget != null && evt.target.dropTarget == myTarget) { // do what ever here i++; }}
I am making a profile sort of thing, basically what happens is: You start the program... it loops, and generates 500 text fields, it stores them in an array called profile_name[]; it names them "Profile + (i+1) (i being the var used in the loop). Changes the colour to yellow, changes the size to 13. Removes the border from it and makes it unselectable (the text). It then converts the text into a movie clip (as if you made a dynamic text area, on the stage, and clicked it, and pressed f8, and converted to mc). It stores that in an array called profile_mcs[]. I need a way to access the text inside the movie clip in both they're arrays...
Example If you go to your flash stage, make some dynamic text, call it "ptxt1", you make it unselectable, remove any border if it has one... you name the text "test", you select it, press f8, then convert to a movie clip called "test_text" you name it "pbtn1" (the instance name I mean, when I say name) If you go to the first frame of your main timeline and press f9 (action script section) type pbtn1.test.text = "NEW TEXT", it will name the text "test" inside the mc "pbtn1" to NEW TEXT...
However, if you store them into an array (both text and mc) you can no longer reference them like this: MyMC_Array[0].MYText_Array[0].text = "NEW TEXT", It doesn't show up, and making 500 if statements is to much (I think my problem may be when I traced my dynamic text inside the movie clip (that I've made on the stage) it appears as undefined.
Code: var profile_name:Array (my text var) = [ptxt1, ptxt2, ptxt3, etc..]; I've tried doing Code: var profile_name:Array = [pbtn1.ptxt1, pbtn2.ptxt2]; etc.. None works,
I need to create an array inside a movieclip, so: var Container:MovieClip = new Movieclip; Then how do I make an array inside of the that movieclip. I've tried Container.mCONTENT:Array = []; But I get "Label must be a simple identifier"
how I can access array data inside of an mc from the main timeline.. I am hoping to get into an array called children, which is inside of an mc, which itself is inside of an array called mcs.
Here is what I am trying to get to: mcs[m].children[0];
I've made it so when you die in my game, you explode into 20 particles which usually lags the game, especially if it's being played in a browser. I'm pretty sure that it's just because of the graphics,why it's causing so much lag? I've included the AS2 just encase.
I have an array with 10 buttons with random names, so not btn1, btn2, etc but for the sake of examples, I'll use btn1, btn2 etc each of these buttons have dynamic text like so btn1.textField.text = "something random" etc also in each of this text there is a delimitator "%#%" I can easily use
I've been working on a little particle generator that produces intractable particles. When you click your mouse, they will move in a straight line away from where you clicked. Seems simple enough, but I can't quite get the formula right.
I want to pass two points and a magnitude scalar value into a function and have it move the particle along the line drawn through the two points, and only as far as the magnitude specifics.
For example:Let's say the particle is at the point P(10,10) and the mouse clicks at the point Q(15,15). I pass both those points and the magnitude 10, into my function.
The function then calculates the angle the particle should travel (45 degrees or PI/4 radians) and sends the particle to the point O(20,20), again, as specified by a magnitude of 10.
Edit: By the way, I'm using ActionScript 3.0, but if possible I would prefer a universal explanation in case I decide to program this in another language, or I am without a programming language when I need to figure it out.
I know I am a new member but hopefully my question won't be overlooked because of this fact. Anyway, here goes. I have a new project, a flash intro, and my client wants to be able to wipe away sand particles to reveal an enter website button. I tried an simple method of wiping away a image layer like an eraser but they want it to look like actual sand particles are moving around.
how to create the type of particle I want and add it to the stage but how can I add multiple instances of this particle, with different values assigned? Here is what I have so far:
Does anyone know of a tutorial on how to make streaking particles. I understand the basics of particles, but I want to make a firework effect, one that leaves light trails or streaks behind for a moment before they fade away.
I am using the smoke AS3 file from: [URL] Everything works great, but I would like for my particles to load on a certain level, for example:
[Code]...
Actually, I would like for my Content to always be on top (pertaining to my layer order on the timeline) and everything else to always be behind, but in the manner described above. I'm not sure how to do this,
i am working on a particle engine for a little project of mine and i cant seem to add any event listeners. I have uploaded the zip so you can see what i have.
You notice that their are 'particles' falling from the position of the mouse but for some sort of stupid reason they get stuck at a certain point in time.
Also, the three white bars are dragable, but i want them to swing back in to place when you release them. Is this also possible with a tween ? or do i need to code something physic-like.[code]...
I'm new to the forums here and new to AS3 (I have some AS2 experience, and lots of general programming experience).nd I've made a few tweaks, including most significantly, fading out and killing particles after a certain amount of time. But I have a problem: I can't figure out why some of my particles live longer than they should.In more detail:In particles.as, for each dust particle that gets generated, the fadeOut function should get called after half a second, and when that tween is done, the killParticle function should get called. This seems to work for most particles but every now and then a few particles will stick around (i.e. the fadeOut function won't get called)Watch the animation: linkOh, and I'd love to know if there's anything I can do to increase performance as well. This is pretty cpu-heavy right now.All my .fla file does is include particles.as. See code below.particles.as
I am trying to activate a rollOver-function when the mouse rolls over a movieclip inside of a movieclip.On the main window (root), first you rollOver a button where a window shows up with more options (movieclips).From stage, my first movieclip is called "catapultas_read_more" which leads to amother movieclip called "pic1_mc". The label that is going to play when mouse over on pic1_mc is "rollOn".I tried this.gotoAndPlay("rollOn); directly inserted to the movieclip, but the movieclip inside pic1_mc never starts
I'm creating a menu bar that is a movieclip and inside the movieclip consists of the buttons.Now the menu bar is twice as WIDE as what is visible on the stage.The only part you can see is the text 'menu' on a bar.Then when the mouse hits the bar, it flies across the screen to the otherside of the bar where the menu buttons are.Now the menu bar does its animation over 20 frames - the last frame being the frame where the menu buttons are now visible.
I have been using TweenLite for all of my easing. I was wondering what the code is for having a button inside a movieclip not active while the movieclip is tweening.Then when the movieclip does finish tweening the button then becomes active.
How can I get a button inside a movieclip link to a frame in another movieclip on the scene? I tried this code:
function gotoCenter(event:MouseEvent):void { MovieClip(root).centermc.gotoAndPlay(2); } skruetest.addEventListener(MouseEvent.CLICK, gotoCenter);
..where "skruetest" is the button, "centermc" is the movieclip where I want to go to frame 2. I don�t get errors with this code, but nothing happens when I click the button. What can I do?
I'm basically trying to make a bunch of particles jump around. I've used the draw tools to draw a small red puff. When you click the puff shoots up from the cursor a few pixels before falling down.
how to call the information from this .as file in another file. This way I will take out the click functionality from the file I have done and have the puffs shoot out automatically at the mouseX and mouseY coordinates.
I eventually want to have these puffs shoot out from a character as it runs across the screen in a game I have planned. It will make it much easier to have these puffs called from a seperate file I believe.
I want to take any Text sting and form from it text formed by particles in actionscript 3 (In flash flex) I see I need some lib for this. but all libs Ive seen do not have such functionalyty by default...
So I want to get something like this
So Is there any sych lib? or way of doing it with some lib?
It should be Free and Opensource (any license like GPL, LGPL etc will be ok).