ActionScript 2.0 :: Placing MC's On Random Coordinates?
Mar 23, 2005
I'm trying to place 12 MC's on random coordinates. In the attached zip file you can see their positions. I was thinking that I could have an array, in which each 'item' represents an x and a y position for one of the MC's. This array should then be randomized, so that when the thumbs.swf is loaded each MC ends up on one of the 12 predefined positions randomly, so that every time you load the MC's are in different positions. But how do you store two values in an array item? Amnos already helped me out big-time with a different approach I had in mind, but I could not figure out how to continue with this... not doing more with what you gave me...this is the address to that thread:[URL]..
What I really want to do is, what I described above and once all MC are loaded, let them appear in a random order. For example, all is loaded and then make the MC's apperar sequentially with an alpha fade-in from top left to bottom right...or the other way 'round, or build it up in columns.
View 1 Replies
Similar Posts:
Apr 2, 2010
I wanna generate a random triangle with coordinates, which shows the arcs of each corner in actionscript 2.0 with flash 8.0.
View 1 Replies
Apr 29, 2010
I'm working on a simple tutorial, and I'd like to randomly generate the positions of the red and green boxes in the accompanying images anywhere inside the dark gray area, but not in the white area. Are there any particularly elegant algorithms to do this? There are some hackish ideas I have that are really simple (continue to generate while the coordinates are not outside the inside rectangle, etc.)
View 2 Replies
Apr 3, 2010
how i display the coordinates of a random triangle in a graph which ranges from -10 to +10 in XY axis with the points like A(2,1) etc with arcs in each corner, in actionscript 2.0
View 1 Replies
Nov 12, 2009
I have 35 movie clips named mcMyObject1, mcMyObject2, etc. to mcMyObject35Each time the playhead enters the frame this code sits on, I want all of these 35 movie clips to be placed on the stage in random orderI want each one of these 35 movie clips to land on one of these X coordinates: 57, 187, 317, 447, 577, 707, 837 and on one of these Y coordinates: 53, 183, 131, 443, 573. (It's a 7 x 5 grid)Movie size is 1024 x 768Here's my code, which doesn't work:
stop();
var myXArray=[57, 187, 317, 447, 577, 707, 837]; //cordordinates for x
var myYArray=[53, 183, 313, 443, 573, 573, 573]; //cordordinates for y
[code]......
View 8 Replies
Dec 19, 2011
I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue
var lp:Point = new Point(e.localX,e.localY);
I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2
var lp2:Point = new Point(e.localX,e.localY);
now surprisingly it was giving correct values as expected and I went back and changed the code as
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);
now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.
View 1 Replies
May 21, 2007
I was reading the 'Isometric Transformations' tutorial by Danko Kozar and I have a few questions. I understand what all the code does, but not how it does it. First of all, how does the following code work:
transforms x,y,z coordinates into Flash x coordinate
xFla = function (x, y, z) {
// cartesian coordinates[code].....
I understand that it converts 3d coordinates to 2d coordinates, but I don't understand how. What numbers whould be punched into x, y, and z to acquire certain desired effects?Also, what's the difference between moveTo and lineTo:
red line
style(1, "0xFF0000", 100);
plot(0, 0, 0);
draw(200, 0, 0);
View 4 Replies
May 3, 2010
Im making a little app in flash using papervision I want to make a regular movieClip show up in the same place as a papervision object. The coordinates seem like perspective is affecting the number displayed.
View 2 Replies
Apr 6, 2010
I'm designing a website in flash & have imported my images into the library & have placed them on the stage, but when I go to "test movie" to preview my page, some of the images look like this [URL] the funny thing is, when I look at the images on the stage they look fine, it's only when I test my movie that they look cut off.
View 3 Replies
Jul 1, 2010
I have a 6*6 table, and 2 dices generating random numbers. The 6*6 table have empty textboxes which will display the sum of two dices. I have the table and the instance ready but I do not know how to display them onto the right textbox. For example if red dice roll and one and white dice roll a two I hope selec12.text=3. The code I have done are as below
Code:
var row:int=7;
var colum:int=7;
[code]....
View 0 Replies
May 2, 2011
Basically I have this code...
ActionScript Code:
gameOverFinal = new gameOverMessage();
gameOverFinal.x = 265;
gameOverFinal.y = 400;
addChildAt(gameOverFinal, o);
It displays a game over message at a certain time. but if let's say the enemy that killed me is at the exact place where the game over message is the enemy will freeze over the message and obscure it. Is there a simple piece of code that will make it so the message is always on top?
View 9 Replies
Oct 29, 2003
i have an mc in which i want to load an external swf. how do i define its placing;
View 2 Replies
Jun 18, 2009
I have 3 containers on stage holding various buttons but these containers are created in seperate Class files....I want to place the 1 container over the top of another container similar to the way I use addChildAt to specify depths.....is there an easy way to do so?
View 4 Replies
Jul 7, 2009
I am just starting out new with AS3 and I have a question about this block of code I have. i have checked this against I don't know how many examples and it looks fine, yet... when it's run, I get nothing. Traces on everything came out OK.
Code:
var sheep:mcsheep;
var xpos:int;
var ypos:int;
[Code].....
View 2 Replies
Jan 5, 2012
I'm importing and playing an external FLV in my movie using the FLVPlayback component and providing captioning for it using the FLVPlaybackCaptioning component. It's working great. (CS5, AS3, Windows 7)
By default the captioning box plays directly on top of the FLVPlayback Component. I want to separate them, so for instance, i can put content (images and such) in between the Playback component and the caption box.
View 1 Replies
Oct 3, 2009
I have played some more with Flash and come upon something that i would know more about.I tried to make:A scene. when I click the left mouse button on the stage an object(from the librery [graphic]) will be place exactly where the mouse is.I did not really know how to approach this, but tried anyways.
This is my code:
stage.addEventListener(MouseEvent.MOUSE_DOWN, addApple);
Function addApple(event:MouseEvent):void{
//I dont know what to put here to place an object(apple) from the libery
//onto the stage where the mouse is.
};
View 4 Replies
Jun 10, 2010
Ive managed to create a for loop that finds the highest value in an array:
array[0]=max
for(e=0;e<array.length;e++){
if(array[e].value > max.value){
array[e]=max
}
}
but Im trying to create a for loop that places all the values in that array from lowest to highest
View 1 Replies
Jun 26, 2010
I'm intended to create a code where I have various arcs which can be dragged and dropped inside a blank circle. Once a arc is dropped and on dropping second arc it should get placed after 1st arc with-in that circle.
View 5 Replies
Jul 11, 2011
I am trying to figure out how I would get the value of a variable into an XML Object.
I have the variable
var dragonName:String = "Samuel";
var listing:XML = new XML();
listing = <thedragon>
[Code],,,,
However, the dragon name does not show up when I go trace(listing); How do I do it and should I have imported something as well or what?
View 7 Replies
Jan 21, 2010
I need to place a div tag above literally everything else on the page. I've read that setting wmode param to opaque will do it, but also heard that that will only effect IE.
View 2 Replies
Jan 27, 2009
I am trying to import an image and then place the image in two spots on the stage. This is the code I'm using:[code]My problem is rather than placing two instances of the image on the stage, the code above places one image with an x coordinate of 300 and a y coordinate of 0.I thought the code above would place two images. One at point (0,0) and the other at point (300,0).
View 9 Replies
Feb 2, 2010
this is my code it works, but my loader text keeps popping up in the corner not in the middle like I want it to, any one know what I'm doing wrong?[code]
View 0 Replies
May 24, 2011
i am makeing a poker type game. and i have come a lil stuck. i have 8 players around a table. i have a player class that creates a new player when a button is pressed. the prob is io can get all the players cards x & y pos in lines like on the same x or same y axis. but how would i make the cards deal around a table. would i have to work them out and write x & ys for each player or is there another way?
View 4 Replies
Feb 11, 2012
I am building a little app where the user loads a .png image on stage and I want to allow the user to be able to click on a textTool from the tools tab and place text anywhere on top of the image.
View 2 Replies
Apr 12, 2006
I'm putting all my code into one frame for organization. If a button named "dragger" originally has...
PHP Code:
on (press) {
startDrag (this, true, 30, 80, 140, 110);
}[code]....
How do move this code onto my one frame in root? I have to tweak some stuff, right?
View 3 Replies
Jan 26, 2008
I have 100 dynamically generated clips on a stage.
I want to remove the clips one by one over the course of a few seconds.
Can I put a delay into a while loop to make it only loop every 50 ms or so?
View 1 Replies
Apr 4, 2008
I'm working on the Kirupa photo gallery and that works fine. Now I want to change how the thumbnails are loaded in. I would like them to be loaded in a holder (now in an emptyMC) so that I can put a mask/ border on it.
This is the thumbnail function:
Code:
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k,thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
[Code]...
View 1 Replies
Feb 15, 2009
It's been a few years since I've last used ActionScript, so I'm a bit rusty Anyways, I have 16 buttons in my library with linkage names btn0-btn15. I can successfully add them onto the stage by saying something like:
Code:
var tempBtn:SimpleButton = new btn0();
stage.addChild(tempBtn);
I'm going to be tinkering with the buttons layout and positions, and I would like to add each of the different buttons to the stage dynamically with a for loop. I've been trying different variations of this:
Code:
for (int i:int=0; i<16; i++) {
var tempBtn:SimpleButton = new ["btn" + i]();
}
but I just can't seem to find the right syntax for doing this correctly.
View 3 Replies
Mar 14, 2012
I have an action script for a movie clip to rotate around (instance_name.rotation -= 1. and this works fine, how ever i need it to rotate around a point outside of the movie clip. i think i need to move the registration point but i dont know how to do this.
View 1 Replies
Oct 29, 2003
i have an mc in which i want to load an external swf. how do i define its placing;
View 2 Replies