ActionScript 3.0 :: Spawn A MovieClip Somewhere In The Stage Area?
May 30, 2009
I have a mini-game where I have three movieclips:The player (controlled by mouse); A random object that moves around the stage (like the arkanoid ball without the paddle and the blocks); A simple power up.The game is simple: hitting the power up increases your scoreThe game ends when the object hits the player.The question is:How can I spawn the power-up (randomly) on the stage area, every time the player hits it?When that happens I want the following events to occur:1) The power-up to be removed;2) Increase the score by 1.3) Place a new power up randomly on the stage.4) Rinse and repeat.
View 12 Replies
Similar Posts:
Jun 16, 2010
I'm making a game where targets popout from behind walls. I have 3 walls, each wall needs to have his own target. I'd like to make the game spawn the targets randomly behind each wall. I'll tween them to make them go up.
I assume I have to link the targets to their own class and delete them from the stage and have the script spawn them instead, right?
View 1 Replies
Jul 31, 2009
I have some movieClips on stage which are draggable and I don't want them to be draggable outside of a visible stage area. Problem is these movieClips are inside a sprite which is panable and then for whatever reason this bounds doesn't work anymore as I intend it to. How do I fix this bounds?
Code:
var arr:Array = [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10];
var thumbSprite:Sprite = new Sprite();
addChild(thumbSprite);
for each (var item in arr) {
item.addEventListener(MouseEvent.MOUSE_DOWN, startDragCard, false, 0, true);
[Code] .....
View 3 Replies
Apr 24, 2009
I have made a movieclip and gave the frame this actionscript:
------------------------------------------------------------
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {[code]........
it moves fine and stuff but i was wondering how can i restrict the area in which the movieclip can actually move ? my flash file is 550px X 400px and i want to make it so that it can only move in 300px X 200px of the file if you understand ?
View 1 Replies
May 18, 2011
I am really new to actionscript3 but this is what I want to do. I want to use the slider in component to spawn or copy a movieclip to the stage in any random placement. For example if I slide my slider across 1 interval and that interval is assigned like X(times) 10 the movie clip will spawn or copy itself and place it self randomly 10 times on the stage.
View 3 Replies
Sep 2, 2010
how you can spawn a movieclip till the certain time ends like maybe 1minute.
how you do that in a "package" way??
movieclip name is apple.
View 3 Replies
Sep 7, 2010
I'm making a mockup for a client and I need to Load the .swf with the exact stage size so the graphic elements do not float outside the loaded movies stage area. [URL]Basic load code I'm using...
Actionscript Code:
import flash.display.*;var adLoader1:Loader = new Loader();adLoader1.load(new URLRequest("100828_budlight_texas_fight_728x90_jn.swf"));adLoader1.x = 313;adLoader1.y = 162;addChild(adLoader1);var adLoader3:Loader = new Loader();adLoader3.load(new URLRequest("100828_budlight_texas_fight_300x615_jn.swf"));adLoader3.x = 738;adLoader3.y = 0;addChild(adLoader3);
View 3 Replies
Jul 15, 2011
I have my flash doc. and I used a mask to give it rounded corners but you can still see the stage color. I am new to flash so I can use the help. How do I get rid of this or can you even do this?
View 2 Replies
Jul 30, 2009
I want to place my duplicates about one third down from the top and in a small bit from the left. Roughly centre them on stage. My code so far:
for (var i = 1; i <= 6; i++){ duplicateMovieClip ("fish_mc", "fish_mc" + i, i); _root["fish_mc" + i]._x = 500 * Math.random (); _root["fish_mc" + i]._y = 350 * Math.random ();}
View 9 Replies
Nov 25, 2009
I currently have an small animation job that involves an enormous zoom out. To do this I need to scale the symbol containing all the animation out in the main timeline, from extremely close to quite far away.
I have two problems that are preventing me from doing this satisfactorily.
Firstly, the transform panel doesn't work. Specifically, entering scale values only seems to work beween 0 and 100%, anything larger gives unpredictable results.
Second, the symbol has become too large for the work area (I have zoomed out as far as I can go) - how can this area to spread out to the whole of the graphic editing area, instead of the third of it that is on the left side?
For example, I have used the Free Transform tool and scaled the item up 2500%, and now it's too big for the limited work area. To scale it further, or scale it back, I need to enter scale amounts into the Transform panel. After doing this, the figures I enter turn into arbitrary other values and my symbol either warps or disappears entirely.
Ideally, I should be able to look at the stage itself, click on the symbol, scale it in the Transform panel to 3000% and be done with it.
View 2 Replies
Sep 2, 2009
Once again i'm a bit lost XD. The deal is, that i'm making a dynamic "blog like" news viewer, so, when i got more than 2 news (sometimes even with one), all the rest of the news get out of the stage and are not seen.
I have been reading methods about changing the stage size but the question is here, if i manage to change the stage size, all the content will be scaled too, isn't it? That's exactly what i don't want.
then, how do i change the "view area" of the stage.
View 6 Replies
Apr 29, 2010
I was at a friend's house and wanted to show him our website. When I navigated to it, about 10% of the area outside of the stage was visible. It was almost as if the swf had been shrunk by 10%, but still within the stage area (750px x 600px). I'm not sure what's causing it, but I've seen it happen once before with a computer here at our office.
It always seems to happen with Internet Explorer. When we right-clicked on the swf and choose "show all" it filled the area and looked normal. I've never encoutered the problem using Firefox and only some of the time when using Internet Explorer. Not sure if it just happens with a certain version of IE or what.[URL]..
View 1 Replies
Mar 15, 2010
I am trying to grab part of stage area using BitmapData and copyPixels method:
bmd = new BitmapData(stage.stageWidth, stage.stageHeight);
bmdRect = new BitmapData(320, 240);
rectangle = new Rectangle(360, 20, 320, 240);
bmdRect.copyPixels(bmd, rectangle, new Point());
[Code].....
The result i get is an empty .jpg I m pretty sure that the error is in the Bitmap procedure and not the saving one...
View 2 Replies
Aug 30, 2009
I would like to export a specific area of the stage. So, for example. My stage is 400 x 400 and I would like to export only 100 x 100 of the stage at xy 0 pos.
View 6 Replies
Jul 3, 2006
I want to load some mcs randomly on the stage, except for a footer area at the bottom of the stage. Is there a way to exclude just a certain part of the stage using something like Math.random()*Stage and then specifying the bottom 300 pixels as off limits?
I'm using the whole stage because the swf is embedded 100% across the browser, so I can't restrict the dimensions.
Code:
onClipEvent (load) {
x = this._x=Math.random()*Stage.width;
y = this._y=Math.random()*Stage.height;
}
View 14 Replies
Aug 12, 2009
how to speed up the workspace when there happens to be a large amount of text on the stage? I have tried everything I can think of (even choosing outlines only for the layer). It seems to slow down my system even if the layer is not visible. Now doing anything is a chore. I have a pretty fast system, and it's pretty bad that after all these flash iterations I still can't have text on the stage and continue work.
View 3 Replies
May 12, 2010
I am trying to distort a bitmap, I mean, I have this bitmap in the main stage and I want to drag a section to. I don't know, maybe drag the eye of the character in the picture but I want all the bitmap to react or at least the closest region of the point I am dragging. Is that possible? I know the drawTriangles() that is been use to gave this 3D effect, but I need something different.
View 3 Replies
Oct 17, 2008
I know we can track when the mouse has left the stage area in AS3.
But, can it reset a button that would have stayed in its "on" state?
My swf will be embedded in a web page, there are 24 buttons all around its border, and as soon as the mouse leaves the stage, they stay "on", so I want to reset them to the initial state.
View 1 Replies
Aug 28, 2009
I have a Flash interaction where I exchange the cursor for a hand holding a flashlite mc. The entire stage is black. The cursor drags a mask around that illuminates a small image in another mc on the stage that the user has to find (illuminate).2 problems
1. When the mouse is rolled outside the stage, the custom cursor is still visible.
2. When imported into Captivate 3, and I move outside the stage and over buttons for navigation, the cursor is no longer visible, for the rest of the Captivate movie.
Desired functionality:Custom cursor to be visible only when on the stage area and the normal cursor to be visible outside the stage area. The stage area is 400x330.[code]
View 1 Replies
Nov 4, 2010
I have a custom cursor in my Flash document. Now that it is all set up, I want to specify an area that it can be in and nowhere else. Basically, I want to keep it in my navigation area on the top of the stage and not be able to go below it to the rest of the stage.I don't know if it will help or not, but I have the following as my custom cursor code:[code]
View 3 Replies
Oct 12, 2010
Is ther a way to get all movie clips inside a area with AS3 I need this to do multiple selection.
View 5 Replies
Feb 3, 2010
I am wanting to write an if statement which says that when the mouse cursor exits the stage area, remove child.
Was thinking something like if mouse cursor is less than stage.stageWidth or stage.stageHeight?
View 3 Replies
Aug 26, 2010
i insert a preloader in a timeline of the fla , and move the movieclip for the stage resize and hid area menu in the second frame but i have the error #rror #1009: Impossibile accedere a una propriet o a un metodo di un riferimento oggetto null.
[Code]...
View 0 Replies
Dec 12, 2010
I am completing a basic web design class, and have one question for this community.I uploaded several intro slide shows onto a black background. They work fine, but take awhile to load (once viewed and go back-they load much quicker). While waiting to load, the stage area is white. However when I created them, I made sure the stage area was black. Any suggestions as to what I might do to correct this? I just think it would look much better if everything was black until the show appears.The shows were created in Flash CS 4 (ActionScript 3.0), & the site was created in Dreamweaver CS 4.
View 1 Replies
Aug 4, 2011
How can I make that the Mouse Control is only possible in a restricted Area on the Stage?
View 1 Replies
Jan 6, 2012
taking a screen grab of a movie clip while the webcam is on..(the end goal is to create an app where people can put funny stuff on their face e.g an eye patch ect..)Is there any simple tutorials on how to do this?, i've tried the whole matrix thing but im still having issues when i resize or move movie clips around, to get it align with someones face!
View 7 Replies
Jul 24, 2009
Let's say you have a great end product, but you want to make it more processor friendly by eliminating stage listeners that have no reason for existing at certain times. I'm not sure how to execute them. I know that encapsulating listeners in a way that they aren't called until they are needed can be done to conserve the processor...but:
1) Is there a way to kill any event listener that exits the stage area?
2) Is there a way to kill any event listener that gets completely covered by another movie clip? Say there was a MouseEvent.CLICK listener on movie clip "A", but movie clip "B" has a higher index and covers every click-able area of "A".
View 3 Replies
Aug 22, 2004
I have an mc, that i need to have follow the mouse on the x axis.I have that just fine.But my problem is that i need a certain frame within the mc to play if the mouse is at a certain area of the stage.For example,if the mouse is at the x coordinate of 235 to the left, frame 2 of the movieclip will play. I uploaded just a test fla that i was practicing on.
View 5 Replies
Dec 18, 2009
How do I determine the pixel size of the stage or viewing area defined in Flash CS4? Isn't it just stage.width and stage.height?
Okay now the long version:
I'm working on a script in AS3 and Flash CS4, and I'm doing some art by code.
I wanted to make a progress bar for a preloader, so I made a Preloader MovieClip and on that movieclip I drew a white rectangle, and I told it to appear at stage.width / 3 and stage.height /3. It drew it at the top corner instead, and after a lot of experimentation, and reading the ActionScript 3.0 Language and Components Reference I found that a display object's width and height are defined by their contents, and you can't manually alter them to be bigger. So I figured that I could make an invisible rectangle the size of the stage in the background of the preloader MovieClip and that would make it the size of the stage, but I realized that I would still be stuck manually setting the stage size to match what I wrote in ActionScript. Untill the MovieClip containing the Preloader was added as a child object to the stage, which would then set the stage.width and stage.height to match those of the contents.
Now that I talk about it, I suppose I'm looking for the size of the perspective or viewing window, rather than the stage. The stage can be larger or smaller than the viewing window in Flash, can't it? But the perspective of the window is finite, unless you change it.
The thing is I'm sure I've polled this information to position an object at the center of the viewing area before, but I can't for the life of me remember how. So, that's what I'm asking; how do I find the dimensions of the viewing area, so that I can either position an object at the middle, or create an object the size of the viewing area, by code?
View 5 Replies
Jan 23, 2010
my problem is I have a scrolling list. I applied a simple fade in on mouse Over and fade out on Mouse Out using tweenMax.The buttons etc within the list cause the mouse Out to fire when the mouse is still over the list. I can not set mouseChildren = false on the playlist as the buttons inside obviously need to work.
So I thought maybe I could detect if the mouse is inside a specific area and fire the tween functions that way.I could use a stage enterFrame event listener, but that would keep firing the Fade in tween while the mouse was inside the area, and same problem with Fade out tween.How can I set it up so the fade in fires only once when mouse enters the area, and fade out only once when it leaves.
PHP Code:
stage.addEventListener(Event.ENTER_FRAME, playlistFade);
function playlistFade(e:Event):void{
if(mouseX >= 160 && mousX <= 400 && mouseY >= -177 && mouseY <= 100){
[code]....
View 1 Replies