ActionScript 3.0 :: Giving Object Random Stage Positioning?

Jul 20, 2010

so i am giving these objects random x and y coordinates on the stage, but i need each object to be spaced apart from each other (lets say 20px) how can i achieve this. I have got the following code:

ActionScript Code:
for(var i:int=0;i<=bubbleNumber;i++){
var bubble:Bubble = new Bubble();

[code].....

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Stage.stageWidth & Stage.stageHeight Giving Wrong Values

May 17, 2011

In my AS3 code all the elements on the page are dynamically positioned depending on the current width and height of the SWF - providing it's not under a certain value, then the items are back in their original position.

When debugging in the Flash player the size all reports correctly however when run from a web browser it does not - initially.

This is my HTML & PHP code for the entire page:

HTML Code:
<?php
function hashId($fn) {
$hash=md5_file($fn);

[Code].....

But I cannot get the size to report correctly without, say, clicking a button.

It seems to me like I need to force flash to re-draw the screen, but I had no luck trying to do that.

View 8 Replies

ActionScript 3.0 :: Random Positioning Without Overlaps?

Aug 19, 2009

How can i randomly position movieclip on the stage without overlapping them.?

View 1 Replies

ActionScript 3.0 :: Set A Random Order Of Positioning

Nov 23, 2009

I have 9 moviclips and 9 positions: one_mc,two_mc,three_mc,four_mc,five_mc,six_mc,seve n_mc,eight_mc,nine_mc

1.How would I assign 9 set positions

2.The set a random order of positioning so that the movieclips randomly positon.

View 1 Replies

ActionScript 2.0 :: FMX: Gravity And Random Positioning

Aug 16, 2005

i have a game where fish fall out the sky and a penguin on ice skates has to catch them before the fish get to heavy for the ice, the ice cracks and the ice skating penguin falls into the water and freezes. I have all the code but cant work out how to set the random location along the Y axis for the fish to fall. I have a gravity script but cant work out how to include the random position for the fish. There are 30 fish and i want to be able to have one fish fall wait a half a second and have another fall and so on....until all 30 have been dropped...

My gravity script is this:

ymov = 0;
grav = 2;
_root.onEnterFrame =function() {
ymov += grav;

[Code].....

Anyone know how i could set a random location in this or something similar?

View 1 Replies

ActionScript 2.0 :: Giving An Object Two Actions?

Jul 31, 2005

I have a flashslideshow with three buttons.

1.slideshow play(which is a mc with frame labels open and closed)

2. next button

3. prev button.

My problem is that when either button 2 or 3 are pressed during the slideshow it doesnt reset my slideshow mc button to frame label "closed".

View 8 Replies

Giving Stage Focus When First Opening In Browser Window

Jun 25, 2009

Is there any reliable way to give the stage focus when you first open it in a browser window WITHOUT first clicking on the stage? By reliable, I mean something that works across different browsers and on both PCs and Macs.I've seen numerous threads on this subject, and I've read the Adobe tech note, and it seems there is no reliable way.How in the world can Adobe ask people to use Flash and not provide a reliable way to give the stage focus on startup.

View 1 Replies

ActionScript 3.0 :: SoundTransform Object Giving A Null Reference?

Jul 15, 2009

Somehow my class is giving me the following error, after I added a SoundTransform object.What am I missing  The issue is somewhere with the

private var soundTrans:SoundTransform;
soundTrans = new SoundTransform();
Why would that be happening?

[code].....

View 5 Replies

AS3 :: Android - MovieClip Keeps Giving Me A NULL Object Reference

Dec 3, 2011

I have a Android Air application, where I import a png image to the stage on frame two and converted it to a symbol as a movieclip. I am performing a hovering animation using this image as a movieclip and it works great but when I go from frame 2, where the animation is, and I move to frame 3, 4, 5, or 6, and then I move back to frame 2, my application throws a errors when referencing the movieclip again. The error is 1009 cannot access null object reference. So to me it seems that once the timeline moves away from frame 2 it wipes away the reference to the imported image converted to a movieclip....is this correct? Is there a way I can keep the timeline referencing the this image as a movieclip so I can always come back to this frame?

View 1 Replies

ActionScript 2.0 :: Positioning Mcs On The Stage?

Aug 24, 2011

I'm trying to make some mcs be displayed from alpha 0 to 100, one by one in the stage and in random positions. I've managed to make appear it randomly from alpha 0 to 100 with this code:

Code:
mcs = new Array("mc0", "mc1", "mc2", "mc3", "mc4", "mc5");
mc0._visible = mc1._visible = mc2._visible = mc3._visible =mc4._visible =mc5._visible = false;[code]....

The strange thing is that only some mcs are positioned randomly and others stay in the same position.

View 3 Replies

ActionScript 2.0 :: Positioning Mcs On Stage

Aug 24, 2011

I'm trying to make some mcs appear to alpha 0 to 100, one at one in the stage and in random positions. I've managed to make appear it randomly from alpha 0 to 100 with this code:[code]The strange thing is that only some mcs are positioned randomly and others stay in the same position, but not always the same.

View 1 Replies

Actionscript 3.0 :: Determining Which Mc Is On Stage And Positioning It?

May 19, 2011

I have a series of movieclips acting as buttons that load different flashvars video srcs onto the stage.When the swf loads --- the first button is added to the stage after a 20 sec Timer completes.As you click through each button, the one just CLICKED is removed and a new button is added in its place.All the buttons are set to dynamically be centered on the stage. However, the function that is positioning them is called BEFORE the first button is on stage, throwing the error (Error #2007: Parameter child must be non-null.)here is the code inside of the windowResize method which positions the buttons.

Code: Select allprivate function onWindowResize(e:Event):void
{
//position hidden buttons[code].....

Even though I've set up a boolean var and set it to true after the first button has been added to the stage -- the method still tries to find the first button and gives me a error saying that it must be non-null.Basically I want to make sure that it doesn't try and position the first button before it has been added to the stage. I'm not sure if encapsulating this method inside of another Timer is a good idea.

View 1 Replies

ActionScript 2.0 :: Y Positioning - Keep Browser At Top Of The Stage

Jul 29, 2008

I have a bottom bar on a site that has he following code: nav_menu.menu_bars._y = 0; But I want it to be at the top of the stage. Sorry for such a noob question, but how do it? I've tried nav_menu.menu_bars._y = -600; but when the browser is resized it obviously moves down the page. Is there a bit of code to keep it at top of the stage?

View 1 Replies

ActionScript 3.0 :: Positioning After Stage Resize?

Aug 25, 2011

coordinates in flash, particularly after resizing the flash player window.I have an mc on stage and draw an ellipse inside that mc. The movie is of size 800 x 600.

Code:
var ellipse:Shape = new Shape();
ellipse.graphics.beginFill(0x6CCDF4, 0.5);
ellipse.graphics.lineStyle(4,0x186B87);

[code]....

If I check the coordinates of that ellipse from it's transform property, I see that the top left is at 400, 300.

Code:
ellipse.transform.pixelBounds.topLeft.x
ellipse.transform.pixelBounds.topLeft.y

This seems fine to me as this position is in relation to the stage, yes? If I convert this to a position local to the container I get values ~0,0.

Code:
var stagePoint:Point = new Point(ellipse.transform.pixelBounds.topLeft.x, ellipse.transform.pixelBounds.topLeft.y);
var localPoint:Point = join.canvas.globalToLocal(stagePoint);

When the flash player window is resized, the coordinates change entirely. Instead of being at 400,300 the transform property indicates that it is at 640, 510. I assume this is because the viewport has changed, but the stageWidth and width properties of the stage do not change.

View 12 Replies

ActionScript 3.0 :: Positioning External Flv Files On Stage?

May 21, 2009

i am loading 3 flv files so that the first file plays once and the other two loop afterwards. Now i am interested is it possible to position the flv files on the stage to certain coordinates when they start to play (so for example that the first flv plays as default in the centre, the second flv file plays a little bit right and the third plays a little bit left). This is the code i'm using:

[Code]......

View 9 Replies

ActionScript 3.0 :: Positioning XML Slideshow Images On Stage

Oct 12, 2009

I have a xml slideshow that is working fine. The problem I am having is all of the images load in at x=0 and y=0. I would like to have the images load at a specific x coodinate and y coordinate on the stage. I have been looking at other code examples to see how to fit this in to mine but I keep breaking it.

Here is my code: 

[Code]....

View 5 Replies

ActionScript 2.0 :: Positioning Buttons Always At The Bottom Of Stage?

Apr 1, 2007

I have a group of 6 buttons which on my stage sit in the center and are 20 pixels from the bottom, I am trying to create a bit of a liquid layout, and the browser is going to be able to resized by the user. I want always for the buttons to stay at the bottom in the center of the browser 20 pixels from the bottom no matter wether it is resized too

View 7 Replies

Actionscript 3 :: Positioning Nested Movieclips Based On Stage?

Aug 12, 2010

I have multiple nested movieclip in its own different movieclip, and i would like to arrange them accordingly. My idea was to use the localToGlobal function. I can get the position of the MC on stage, but how do I use the function and place the MC based on stage?

cAPos = new Point(objectA.y);
newcAPos = objectA.localToGlobal(cAPos);
cBPos = new Point(objectB.y);
newcBPos = objectB.localToGlobal(cBPos);
objectB.y=objectA.y+objectA.height <-- based on stage

View 1 Replies

ActionScript 2.0 :: Positioning Big Image To Absolute Middle Of Stage?

Aug 29, 2006

im trying to achieve a Full Browser Flash and i want my bgimage to remain in the centre of the stage whilst other objects move round it depending on mouse movements but how would i go about centering the bgimage through AS?

View 2 Replies

ActionScript 2.0 :: Intervals Using Relative Object Positioning?

Feb 20, 2007

check this code out:

[Code]...

I was wondering, is there a way to change if (myClip_mc._x < 400) { to a relative position of myClip_mc. I mean, i want myClip_mc to move 100px from it's current position everytime the button is clicked. Instead of only moving it if it's x position is less than 400. So it needs to somehow check it's current position everytime the button is clicked and then make it shift from that position. I know this is a long winded way of doing it but i want it this way so i can use it for something different.

View 8 Replies

ActionScript 3.0 :: Tweens Ruining Object Positioning?

Jul 12, 2010

Here's the issue. Say you have a Sprite, on this sprite you have 2 other sprites positioned precisely. For example, you have a Character Sprite. On this Character Sprite it has 2 children, the base, and the hair. It's very important that they're positioned precisely for it to look correctly. Now say for moving the character you have some tweens in place. You tween the character object that contains both the base and the hair sprites. Sometimes, not always but quite frequently, afterwards the two sprites within the character sprite (base and hair) aren't positioned correctly.

View 2 Replies

Arrays :: Positioning Using Previous Object Y Coordinate And Height

May 4, 2011

trying to loop out some pictures using a for loop and cant get them to be posiotioned directly beneath the previous picture, I have set the height number in my xml where I get the pictures from.[code]This is how the code should look like if you are trying to place pictures directly beneath the previously added picture using a class with parameters, in this case the "LoadExternaly" is that class.

View 1 Replies

ActionScript 2.0 :: Object Positioning On A Resized Full Screen?

Jan 29, 2009

There is a small issue that I am not able to solve. Me and my friend are working on a school presentation with many images. The images load as a gallery of piled cards which can be moved and rotated. Now I need to add text on the frame and want it to be aligned to the right of the screen. The stage is aligned to the top left corner. Now the problem is that the text doesn't place itself at the right position on the screen.

View 2 Replies

ActionScript 3.0 :: Cannot Visit Stage Attribute Before Display Object Added To Stage

Oct 22, 2009

I have a library swf (asset.swf), it's document class binded to Asset.as, and in the Constructor function of Asset,[code]as known to all, we cannot visit the stage attribute before the display object added to the stage.so, when my loader.swf try to load asset.swf, it throws exception and the loading come to failure is there some one tell me how to load the asset.swf? I cannot modify the asset.swf.

View 0 Replies

CS3 :: Start From Scratch Or Move Every Object That Is Off Stage Onto Stage

Jul 30, 2011

figure out why the movie i just made is off stage. I just I don't want to start from scratch or move every object that is off stage onto stage. What did i do to get it here to begin with???

View 1 Replies

ActionScript 3.0 :: Object Position On Stage Without Using Stage.align

Apr 23, 2010

I have a stage bigger than the size of a browser, and I have a camera to navigate around the area.Now when I click on a button, I will have something pop up blocking the whole browser, like a lightbox effect with another box on top of the blocker.The problem now is, when the blocker pops up, its position is not on the TOP LEFT corner of the browser. I've tried stage.align, but it would makes the camera or other object on stage position run.So is there any other way I could get the blocker to position according to the browser, not the stage?[code]

View 1 Replies

ActionScript 3.0 :: Detecting Stage Object Positions From Library Object Class File?

Sep 14, 2010

Ok. So heres what I am trying to do. I want one movie clip to follow another one that I move around with actions on the main timeline.The problem is that the follower clip is linked to a class file and I cannot find a way to find the players position.

[Code]...

View 8 Replies

Actionscript 3 :: Difference Between Object Main Timeline, Object Stage And Root ?

Sep 3, 2011

I want to know the difference between [object main timeline], [object Stage] and root in as3? I have read from the topic How stage, root, and MainTimeline Fit Together. But I didn't get clearly.

View 3 Replies

Flash :: Using HitTestPoint With Stage Object To Create Object Boundaries

Dec 15, 2011

I'm trying to create a boundary for a player object, controlled with arrow keys, in my game using the main stage's height and width. For example, one test point is at the top edge of the player object's bounding box so that when the player object's head touches the stage's top edge, the player can't move anymore to the north. The player object is manually instantiated to the center of the stage by using the Flash stage editor so it will start at the center before the program starts.The problem is that right at the start of the program, I can no longer move the player object up or down with the arrow keys but I can still move it left or right. The intention is to allow the player to move north until the player object's head touches the top edge of the main stage.[code]

View 1 Replies

ActionScript 3.0 :: Make A Class Object Interact With An Object On Stage?

Aug 2, 2010

The following is that long only because I gave examples of what I want to know, not because it is complex .I have three basic questions regarding AS 3.0 classes.

1. How can I make a class object interact with an object on stage?

For example, when I have a square (mc_Square) with class "square" attached to it and I want it to trace "Colliding!" and print the X and Y of the mc_Box on contact with an on-stage *hollow* box (mc_Box) that has no class attached to it.how to do it vice-versa would also be awesome .

2. How can I make a class object interact with the same class object? For example, when I have two squares (mc_Square) that both have the class "square" attached to it and when they collide, it prints the X and Y of both of them.

3. How can I make a class object interact with a different class object?

For example, when I have two squares mc_Square1 with class "square1 (that also has a variable Primary=true written in it)" and a mc_Square2 with class "square2"; When they collide, the one with Primary=true would be removed and it's X,Y position traced.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved