ActionScript 3.0 :: Send Small Gradient Circles Across The Stage And They Somehow Disappear?
Jan 27, 2009
I'm trying to send small gradient circles across the stage and they somehow disappear around x 515. If I increase the size the problem goes away ( though increasing the size to 2px only make them go another 100 px x before disappearing). The problem does not exist with non gradient circles.Here is the code:
I'm creating a mask in what can best be described as a glorified spotlight effect program. It involves dynamically creating a gradient circle that will be the spotlight in question. However, I've run into a problem while creating gradient circles dynamically.
Code: // in CS4 var testCircle:Sprite = new Sprite(); testCircle.cacheAsBitmap = true; // this can be true or false; doesn't fix the problem
[code]....
However, no matter what you put as CIRCLE_RADIUS, this will always output an approx 100-radius gradient in the center, and whatever is left over will have 0.0 alpha the rest of the way.So if you make one with a radius of 300, it'll show up as a circle with radius 100 and 200 pixels either side of blank space.Intersetingly enough, if you set the radius to less than 100 (say, 80), it'll cut off the circle at the radius and leave you with a hard edge.
I've found that if you set the ending alpha to anything other than 0.0, the full gradient is rendered. But I don't really want a hard edge Of course, fancy matrix transformations can fix this. But even those are unpredictable for some strange reason...even an identity matrix scales it drastically.Or do I have to go with pre-rendered ones or fancy matrixwork?
I've bee following this site for a long time, and now I finally got a question on my own.
I'm trying (by ActionScript) to make a bunch of small circles form a complex shape e.g. a star or a windmill.
I'm planning to draw on circle and draw it to bitmap date, but I don't know how to place a lot of circles in the shape of a complex shape (or how to transform them into another complex shape).
I have a rectangle-shape instance in a MC, this instance functions as button with Mouse Event. ROLL_OVER / MouseEvent.ROLL_OUT.In this MC every time on roll_over it generates (addChild) a random number of small circles which appear spread around on top of the rectangle shape. After a certain duration they're removed by scripting.The problem is that while they're there, exactly THOSE areas of those small circles lose the Roll-Over triggering, only those areas not covered of the rectangle still works as roll-over.I guess it has something to do with FOCUS or something but haven't been able to figure out yet how to remove focus / circumvent those small circles from preventing roll-over.
how to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out..
I was wanting to do a quick class that generates an image from another image similar to the way the Killers "Day and Age" album looked like: [URL] The problem I'm running into (mentally, haven't started coding yet) is that I'm not sure how to place all those randomly sized and placed circles on the stage in such a way that they will completely fill it.I have thought of two methods, but both seem inefficient:
1. Use Box2D to create a new area where randomly sized circles drop from the top of the screen and fill the screen. Then, when all circles have settled, just track the size and position of each.
2. Select a random spot on the screen. Create a new circle, and test how big it's maximum diameter can be until it bumps into other circles or reaches a set maximum diameter. If it cannot become larger than the smallest allowed diameter, don't place a circle there, but move on. Repeat until too many tries in a row don't allow you to place any more circles.
I'm trying to create three circles on the stage, one red one green, one blue. When Red overlaps blue, I want the overlapped area to be magenta. When blue overlaps green, the overlapped area should by Cyan. When red&green, it should be yellow, and when all 3 mix it should be white. How do I create the color effect. Right now I have the overlap constraints working and a simple TRACE outputting the color. I need to know how to create the color effect when they mix.
The basic area: add 5 circles on random locations on stage... and animate them to random locations on stage without touching each other...
The problem:: The code below works perfectly (up to a certain point). It succeeds in making the circles animate to random points on stage. It also succeeds in detecting if once circle comes to close proximity with another circle... Code on main timeline:
Code: var enemyArray:Array = new Array(); var timeToCreateEnemy:Timer; // set up timer that will fire every 2 seconds, 5 times timeToCreateEnemy = new Timer(2000, 5) timeToCreateEnemy.addEventListener(TimerEvent.TIMER, createEnemy); timeToCreateEnemy.start(); [Code] ......
I need to use a Timer for time controlled animation, time the drawing to occur every 500 milliseconds & Draw 20 circles in total. I also need to make sure the circles are completely drawn inside the limits of the stage...
import flash.events.TimerEvent; import flash.utils.Timer; // creates a new hundred-second Timer, ticks every 250 milliseconds var faster_minuteTimer:Timer = new Timer(250, 6); // designates listeners for the interval and completion events [Code] .....
add 5 circles on random locations on stage... and animate them to random locations on stage without touching each other... THE PROBLEM: the code below works perfectly (up to a certain point)... it succeeds in making the circles animate to random points on stage... it also succeeds in detecting if once circle comes to close proximity with another circle... only problem is, i dont know what i should do next...
I'm trying to create a game where circles appear on the stage and when the user clicks on one it disappears and their score is updated. The circles appear for a short time then dissapear. If they dissapear before the user clicks the user looses points. The game is to last 20 seconds then the user will be shown their score and a little thanks for player message. This is what I have so far:
stop(); addEventListener(Event.ENTER_FRAME, playGame); function playGame(Event):void {
[code]....
Now what I'm having trouble with is all the timing. I need a way to turn the visibility off the circles after a few seconds of being created and I also need to set the duration of the game for 20 seconds.
anyone know of any tutorials or any codes on how to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out.. yeah, by the way i have attched the file so more or less u will understand wat im saying.
let's say i have this object on stage and it is called myShape and i want to manipulate it via action-script and apply a gradient color to it .. no if it is a fill color i could have used the colortransform method but i don't think that it will work ..
import flash.geom.* import flash.display.* var fillType:String = GradientType.LINEAR;[code]........
now when i test this i don't get any errors but i doesn't apply any thing ..
my first time trying to draw a multi-color gradient in actionscript 3. So I got this code from the help docs, but I can't seem to get a vertical gradient, whatever formula or number I use for rotate, it stays stuck on the default horizontal gradient :(
I'm trying to create spinning rays in actionscript to use in my website.Below is the rough idea of what i'm trying to create.Is it possible to create absolutely with 0 images.Following is the actionscript code in which i couldn't figure out how to add gradient, transperant background and little radial gradient to create glow effect.
Code:
function CreateRays():Shape { var ray:Shape = new Shape(); ray.graphics.beginFill(0xFF9900,.5); ray.graphics.lineStyle(1,0xFF9900,.5);
[code]....
If you paste above code in 1st frame of your scene with nothing on your scene, it will give you sweet rotating rays!
I am making a small banner that is populated with text, and slides across the stage. There are 3 attributes in the xml: One for the message to be displayed One for the link and one for the target (window).
All works very well...except for one thing. In AS2 I was able to replace a link if I needed, with a asFunction in order to trigger a function in the main timeline. This bit isn't working. So asFunction was replaced with a text event, tho this won't work for me here, I think...
This is my xml: Code: <?xml version="1.0" encoding="UTF-8"?> <messagelist> <message myURL="asFunctiom:this.parent.btn1Click_xml" myTarget="function" myMessage="Buy me, buy me now, damnit! 0" /> <message myURL="asFunctiom:this.parent.btn2Click_xml" myTarget="function" myMessage="Oh horsefeathers, you still there? 1" /> [Code] .....
We are making a simple Flash game intended for mobile phones via Flash 5.5 using ActionScript 3.0.We are animating an array of objects vertically until they hit another object at the top of the stage.We instantiate each element of the array with one of 10 MovieClip animations.Each object has two event listeners; one to animate vertically and another to listen for a mouse click(which removes the object from the stage).We run into an issue when more than 10 objects are on the stage at one time.The issue is that the objects disappear sporadically and without explanation. We assume the problem is due to some type of memory/ garbage collection issue.Below is a snippit of our code that dispatches the MovieClip instances onto the stage.[code]What can we do in order for the MovieClips to not disappear?
I am creating a miner game (where there are pieces of gold and you have to catch them with hook).I modified the Main class to take all children of MovieClip(root) that has name "Gold" and them put them in an Array(boulders[]) where later check collision (I design and put on stage several "Gold" MovieClips for every level). When the player collects all gold (when the boulders array.length <= 0) then goToAndStop(nextLevel), where again it takes the gold MovieClips from the stage and if it's name is == "Gold" then put's it in the boulder[].
What happened: On the first level(frame 2 cause frame 1 is the preloader) everything is good - I have 2 gold MovieClips on the stage(in design mode) and all 2 gold are put in the array and displayed.
On the second level I have 4 gold and only 2 of them are put in the array and displayed.
On the third level I have 7 golds designed on stage, but only 3 are displayed and put in the boulder array.
It's almost the previous count of the gold(on the previous frame) are subtracted from the count of the next frame gold movieclips.I am placing the Main.as code:
public function createLevel(){ nextLevel = this.currentFrame + 1; for (var i:uint = 0; i < MovieClip(root).numChildren; i++){[code]....
I'm attempting to learn flash using Adobe CS4. I've found some really good tutorials, but I can't use them because every time I draw something on the stage, the resultant drawing disappears immediately after I release the mouse. Since I can't see it, I can't select and manipulate it. I captured the behavior and stuck it on youtube. I don't have a mike on this system so there's no sound. [URL]. If I create the file with ActionScript 2.0 instead of 3.0, I get outlines of the objects, but not the objects themselves. That's not on the vid, but I'd rather use 3.0 anyway.
lets say I have animated a car entering the stage area from outside the stage. When I render the SWF at first only the content on the onstage area is visible but if I resize/enlarge the window I can also see the car(content) lying outside the stage just like in the flash file. How can I make sure that no off stage content is visible at all in the final SWF?
I am a newb to Flash CS5 Pro, so I can't tell what is wrong. I have multiple objects on my stage that I copied to create afull effect. Most of the objects perform perfectly, but the ones on the edge of the stagedisappear when I export to video. When I zoom in to look at them, they are there,but when i zoom out to fit to page, they are gone
I have been trying to make a score counter for a small game where the user clicks on a button on the stage, each time the user presses the button the score increments by 10, however I cannot get the score to display on the dynamic text field.
var score:uint; //scoreCounter is the instance name of the dynamic text box function updateScore():void{ score += 10; scoreCounter.text = score.toString(); }
I am generating movieClips outside of the stage I want to send them randomly into the stage in enter frame. Currently it looks like this, so they go like in all directions... How could I direct each of them randomly into the stage?
Code: function timerEvent(e:TimerEvent):void { var newObj:MyObj=new MyObj(); //this places them randomly outside of the stage
i want to send an object and its properties (that have been manipulated) to my server. I then plan to re-create this object and automatically create a screenshot of the object (i do not want to do this client side). i'm planning to use POST and some php for each property as its changed, and then load this data into a server side as3 script. i would like this server side script to take the object in automatically, and create an image server side - is there anyway to doing all this while not prompting for any input (from what i've learnt, flash needs a prompt before saving a file)? i haven't used flex, could it be used here?
I've successfully created an FLVPlayback component using the component library and it's playing the streaming video that I want it to. My question is, if that stream is not online or cannot be found, how would I go about displaying a message on the stage to let the user know, there is no active stream.
UPDATED: Here's my code -
thestream.addEventListener(NetStatusEvent.NET_STATUS, onNCStatus); function onNCStatus(event:NetStatusEvent):void { trace(event.info.code)[code].....
There's no output still. It seems like the function isn't getting invoked. However, if I place a trace outside the function (before it), I get a response: trace(NetStatusEvent.NET_STATUS);