ActionScript 2.0 :: A Selection Of Blocks Random On Stage
Apr 6, 2007
i have a number of movieclips. let's say 20. every movieclip contains one black block - and they're all different in size.
i want to put them one by one in random order on the stage until the space on the stage is filled like this: [URL]
in other words: when only 4 movieclips fits on the stage it shows 4 movieclips, when 8 movieclips fits... etc etc
View 1 Replies
Similar Posts:
May 3, 2010
What I want to do is to get the movie to display random images (from a selection) for random amounts of time (subject to minimum and maximum times).
View 3 Replies
Jul 23, 2011
One of my main interests is playing games so I thought why not make a game? I see lots on the Internet games based in Flash so I thought that would be my best starting point to make actual graphic based games... (not to mention I actually got taught at university how to use flash to a certain extent). The game I decided upon was tetris. I'm sure you're all familiar with the block based puzzle game and might be able to shed some light upon what I am doing right and what I am doing wrong. So, I've firstly made my game screen with a window for all the blocks to come down in.
I've also put some dynamic text place holders ready for when I come to keeping track of how many 'lines' the player has scored, the time and so on in the right hand side of the screen. I have made graphics for the different colour 'building blocks' (just one block of 24x24 in different colours for each shape) and then used the 'building blocks' multiple times to create my shapes (I, J, L, O, S, T, Z). These blocks are called tetrominoes. Now I've come to a point where I need to import these tetrominoes randomly from the library and get them to appear in the middle just off the top of my block screen.
How do I import random objects from a particular folder in my library to the stage in Flash CS5 AS3? After realising a quick solution to my problem was not to be found quickly I then thought about what will happen to this block once it has been imported... Well, in Tetris the block moves slowly down until it hits another block or the bottom of the block screen. I know that I can do something with a detectHit() function. How do I get my block to move down the screen by a set amount of pixels every second or so?
View 4 Replies
Dec 22, 2010
How can I make an array in flash as2 and from there select 12 values assigning them to twelve different variables?So far I got this:
quotes = new Array();
quotes[0] = "one";
quotes[1] = "two";
[code]....
View 2 Replies
Jun 9, 2006
i need to be able to make a random selection from three choices. Basically i'll have three seperate .swfs (probably named "1.swf, 2.swf, 3.swf") and also three separate mp3 files (probably named same way).The container .swf will have a function which will probably make a 'random' selection from the three .swfs of which one to load and also make a 'random' selection from one of three mp3 files to load
View 5 Replies
Jun 8, 2007
I am creating a web site for a kitchen company, there are differen images as headers on each page. But on one of the pages they want a flash animation to slideshow their kitchens. The animation is done, but they want it to start on a random kitchen. I have only started using actionscript and am struggling a bit, I've managed to find some coding, but they don't seem to work. What I'm looking for is a code to sit in the first frame to randomly select either frame 2, 12, 22 or 32 to go to and play on from there.
View 9 Replies
Nov 6, 2009
I need to tell a button to go to a random frame of 6 frames. Lets say these frames are 20 to 25.
Now I think I understand most of this except one thing. How do I change this script to pick a number from 20 to 25, rather than 1 to 10?
Here's my starting point:
ActionScript Code:
generateNew = function () {
n = Math.round(Math.random()*10);
};
[Code]....
View 2 Replies
Jul 22, 2006
So this is a bit of an unusual problem. I am building an XML based MP3 player. I'm fairly inexperienced with Actionscript, so I copied the code from a friends music player. The code works great - but the player I am making also has 'highlightable' buttons for each song. It is easy enough to get these buttons to highlight when clicked. However, when first opening the player, it opens a song randomly but obviously the song's button is not highlighted. Is there a way to have the player highlight the corresponding button when opening? The cop-out solution would be to just have it open the first song every time. But the random selection could really make returning to the site a new experience.
[Code]....
View 3 Replies
Dec 2, 2004
How do I randomly select 1 of 4 tell target movies? (Flash MX Actionscript)
View 1 Replies
Mar 19, 2010
how to literally describe what I want to achieve. But I believe it is an easy achievement for someone who is a little familiar with Actionscript (2).
I have a movieclip with backgrounds that fades in and out as the timeline within the movieclip plays. What I wanna do I place an actionscript at frame 1, before any of the background plays, that randomizes a gotoAndPlay function that jumps to a decided frames out of frame 2, 77, 152, 227, 302, 377 etc.
It should be a problem to use the same actionscript after each background has been shown? If it is, its no problem, doesnt matter too much. As long as the first background that is getting randomized is different each time you visit the website.
View 3 Replies
Jun 3, 2010
I have a short movie which consists of 6 MCs. What I would like to be able to do is to start the movie on a random clip and then proceed as usual playing each consecutive MC. The movie then loops back round to frame 2 thus avoiding the random selector code which sits on the first frame of the movie.I have tried three different solutions of AS, two of which I got from a 2008 posting on this site from CBadger and although all versions work in Safari and v1 & 3 work in Google Chrome on the Mac. None of them work in Firefox on a Mac (the 1st version displays but doesn't randomise and v2 & v3 don't display at all) and I have not yet tested them on a PC.Here is the code that I have used for each version on the first frame in the root:
Array.prototype.shuffle = function() {
for (var ivar = this.length-1; ivar>=0; ivar--) {
var p = random(ivar+1);
[code]....
View 4 Replies
Sep 17, 2009
I'm a designer working in tandem with a PHP programmer on a project where we will display a random image via flash from a selection of images stored on a database. Accompanying this image is a tagline and a path for a button and these variables are sent via a php script. The actionscript then picks up these vars via loadVars and displays them on screen - well, almost.
The tagline is displaying in the dynamic text box with no problems, but I'm struggling with how to display the image in the empty MC I've created (called 'pic') and also to attach the path to the button I've created (called 'projectURL_btn'). I'm fairly sure it's something fairly simple but I just can't crack it.
[Code]...
View 0 Replies
Oct 11, 2010
I m using textarea. The problem is when i try to select a text and go out of stage and leave the mouse then again move mouse on text then selection of text will move with the mouse.
Here is what causes that:click somewhere on the text and drag the mouse in order to select the text then go out of the swf leave the mouse now move mouse on textarea -> the selection of text will move with the mouse...
How to stop this behavior?I tried to implement mouseleave on stage but the problem is i m not able to detect mouseleave event when mouse is pressed and it leaves the stage.
View 3 Replies
Nov 16, 2010
I'm looking to send a list of variables (say 6 in total) from php to flash and for flash to pick a random one and send it back to php when clicking a button.
I would like it to appear in a dynamic text box. That randomly selected variable needs to be sent back to php on pressing a button.
View 2 Replies
Nov 16, 2010
I'm looking to send a list of variables (say 6 in total) from php to flash and for flash to pick a random one and send it back to php when clicking a button. I would like it to appear in a dynamic text box. That randomly selected variable needs to be sent back to php on pressing a button.
View 6 Replies
Nov 11, 2010
I never realized that fl.getDocumentDOM().selection doesn't retain the selection order... <sniff>. I was hoping to build relationships based on the order. I guess I took if for granted that tools like Maya and Max store the selection buffer in order of what was selected. I'm trying to avoid: Select Object, <Press 'Parent' Button>, Select Parent, <Press 'Parent' Button>
View 2 Replies
Sep 6, 2007
i am attaching a number of _mc (my_mc) with a for loop. Inside each my_mc is an input textfield (my_txt)I want to click on my_mc.my_txt and select the textfield .the following code allow this and i can enter text from the keyboard however I want to add text from a _mc keybooard on screen (here called myBtn_mc).As soon as I click on myBtn_mc of course I lose focus ... i have tried to use a variable (select) to keep scope&focus
View 6 Replies
Sep 1, 2009
I have a movieclip on the stage(lets call that selection movieclip) that once a button is clicked is going to open another movieclip(call this slideshow) I am trying to remove the selection movieclip when you launch the slideshow movieclip.
Error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at mc_work/clickHandler3()
[Code]...
View 9 Replies
Oct 11, 2010
I m using textarea in flash 10 cs5 as3. The problem is when i try to select a text and go out of stage and leave the mouse then again move mouse on text then selection of text will move with the mouse.
Here is what causes that:
* click somewhere on the text and drag the mouse in order to select the text
* then go out of the swf
* leave the mouse
* now move mouse on textarea
the selection of text will move with the mouse. How to stop this behavior? I tried to implement mouseleave on stage but the problem is i m not able to detect mouseleave event when mouse is pressed and it leaves the stage.
This is because of wmode="opaque" parameter. I found out that it doesn't do this when wmode="window". Is there a solution for this?
View 1 Replies
Mar 27, 2009
I've been trying to simply get random movement on a MC on my stage.
Most of the tutorials I come across deliver jittery motion, not smooth eased motion.
Also, I'm trying this script found here: [URL]
The random motion looks great! .... but I can't stop the MC from moving to the top left of my stage. The script isn't setup to restrict the motion within a given area on the stage. I tried modifying it, got nowhere!
View 1 Replies
Aug 11, 2009
I have 4 MovieClips and they are in Array but i need to randomly fade-in them on stage within the boundaryes of stage. How to do that? I know i have to use Math.random
View 8 Replies
Jan 18, 2010
I've got an MC that walks a path, this path is tweened, not scripted. Now this MC is in my library, I want this MC to spawn on the stage(random) and unload it once it is finished. If possible, I want to have multiple of this single MC on stage at the same time. And finally I want all of them to spawn at the same coordinates.
View 2 Replies
Oct 18, 2010
so i have 3 mc's in my library each with linkage "icon1", icon2", icon3". what i'm trying to do is load one of them randomly in to the stage.
here's the code i have so far:
Code:
//creating an array that holds the mcs
var iconsarray:Array = new Array("mc1","mc2","mc3");
//creating a random number to use for loading the mc
[Code]....
View 1 Replies
Apr 2, 2010
On a game we just completed in Flash Builder 4, there are a couple of links like this:
var sponsorLink:String = http://www.plantersplace.com/;
navigateToURL(new URLRequest(sponsorLink), _blank);
IE 7 in some installations is treating this as a popup. Firefox 3.6, Chrome 5, Safari 4 all fine.
The game in question is at [URL]
Click "continue without logging in, then click "show hint". Click the hint. This should fire the above code and open a new window.
Several users in IE report this gives them a pop up alert. I am trying to find out why and what can be done about it. I have tried the solution I found at Zorked but people STILL say they are getting popup alerts.
View 1 Replies
Feb 17, 2006
I'm doing a few tests to it, and i am wondering, how can you create blocks in the air that you can hit, that won't allow the ball to pass through it, so when you hit it you bounce back down the the ground?
View 2 Replies
Aug 28, 2003
How do I center the blocks in my AS?
[AS]fscommand ( "allowscale", false );
myMap = [ [0,0,0],
[0,0,0],
[0,0,0] ];
[code]...
View 3 Replies
Oct 17, 2011
Actionscript Code:
var imgArray : Array = ['1','2','3','4','5','6'];var loader : Loader = new Loader();loader.load(new URLRequest(imgArray[Math.round( Math.random() * imgArray.length-1
[code]....
View 2 Replies
Dec 22, 2009
I try to put boxes from library on the stage.boxes must appears random + must be on the stage(ie stage = 550x400) + boxes can not intersect[code]...
View 14 Replies
Feb 15, 2010
I want generate random letter on the stage. Look to this letters and enter this letter on my keyboard. How i can generate it? And i try to generate numbers, but i always see wrong message. Why?
[Code]...
View 6 Replies
Oct 18, 2010
I have 3 mc's in my library each with linkage "icon1", icon2", icon3". What I'm trying to do is load one of them randomly in to the stage. Here's the code I have so far:
Code:
//creating an array that holds the mcs
var iconsarray:Array = new Array("mc1","mc2","mc3");
//creating a random number to use for loading the mc
var randmc:Number = Math.round (Math.random ()*2)+0;
//this is just a string to hold the mc with the number, not used
var all:String = (iconsarray[randmc]);
[Code] .....
View 1 Replies