ActionScript 2.0 :: Random Place / Color And Size For A MC / When A Press Button
Jun 29, 2011
I wanted that, when I place the mouse on the button, a movieclip appears, but in a random place in the screen, with a random size and a random color and plays until all its animation is complete, and then disappear.How can I do that? I don't know even where to start!
im currently trying to make a game for a college project, im using flash professional 8, the game rquires a random sound to be played on a button click, but i have no idea how to do that? all my sounds have instant and libary names of sound_1, sound_2 ect and i currently have this actionscript in place on the button, the button is called play_sounds.
play_sounds.on(mouseDown) = function(){ var randNum = Math.ceil(Math.random() * 10); var mySound = new Sound();
I'm used to working with the timeline and don't often go into the actionscript side of things.
I've created a 60 second animation of an hourglass timer counting down, and next to it, is a card showing a word. I need this whole animation to play when you hit a 'start game' button and also I need the word on the card to be a random word. All of the words are saved as separate vector files for now.
What is the best way to manage this on the timeline, and what would be the code to make a random image appear?
I *know* this is simple. I've read every thread on this board pertaining to this (including senocular's Best Of thread), done everything there and this still doesn't work and I can't see why.
I feel like an idiot even asking, because I've seen the examples and lengthy tutorials.
All I want to do, is change the color of a dynamic text field when you press a button. But I want the name of the field to be a variable.
Now, this is what's there:
1. the variable "_root.expinttype1" is equal to "branch" and is set elsewhere. 1a. There is an existing dynamic field called "branch" on screen.
2. On the button release I set the format:
[Code]....
Why? I set a dummy variable txt = _root.expinttype1; and even threw it into a text field to verify the data, and it shows "branch", so why doesn't this work?
I want to make a button that makes you got to a random frame within a certain range (eg frame 41-50) when you press it. I have tried various codes but so far no luck. Im using AS 2 and the button is within a couple of movie clips, but you can still click it when you test
i tried it all but cant solve it on my own. i have 10 different MC,s. they shall appear by hitting a key on the keyboard. all i want them to appear and play on a random place.
all then 10 MC,s are deticated to 10 different keys on the keyboard. (so by hitting the "A" on the keyboard shall place and play MC "A" at a random place..
I�d like to add something more but don�t know how.I[d like to make the MC to load a random color, in a color range that I specify, like #000000, #FFFFFF and #111111.Also, I want somew buttons to change between this colors, but with an ease transition.
In this .swf where can I place the stage color? I am using the[url].... and it made the stage color black? Which is suppose to be #999 .HERE IS THE CODE SCRIPT:
i am pretty new to actionscript. i tried it all but cant solve it on my own. i have 10 different MC,s. they shall appear by hitting a key on the keyboard. all i want them to appear and play on a random place. all then 10 MC,s are deticated to 10 different keys on the keyboard. (so by hitting the "A" on the keyboard shall place and play MC "A" at a random place.
I made flash player and i used that tutorial: HERE. Everything is good, but when one song is ending, next song's start is delay about 1-2 sec. You can say that is nothing in flash mp3 player, but if each other song is one short speaker sentence(there are about 10 one by one) it may be nervous. how to delete that delay? I don't need to have xml playlist. Just i want to start one by one(all playlist is about 300-400 loop/songs/mp3 files) without delay.
Now I think there is no way to delete that delay(how i can do it), but i have another idea. I will make one big file from 10 or 20 of that smaller, but i need to have in my player one thing more. When user will press start button, song won't start at 00:00/xx:xx but in random place. You know what i mean ? It will not start at start but somewhere else, in random place(maybe 00:21/xx:xx or 02:47/xx:xx or 01:02/xx:xx).
I'm making a scroller that scrolls movieclip (text inside). It works quite good but I want to put the final touch on it. I want that my scrollbar is dynamic in its size (just as browser scrolls or windows scrolls). Then my biggest programming problem comes up, maths
The values that I have is - How tall is the area there the text shows. - How tall is the movieclip that the text is shown in - How tall is the place there my scrollbar is shown.
I have a movieclip which is added to the stage every second at a random place.i want all instances of this movieclip to move to the postion x=100px and y=200px on the stage at a rate of 5px.im not sure how to code this, i would like the code to be in as3 if possile as i do not know as2.
I've got a small issue with attachMovie. I've got an array with references to movie clips which I want to place at random locations on the scene. Here is my function:
[Code].....
The thing here is that the trace of "mc" in the beginning returns the correct movie clip reference, but "mc_clothes_holder.mc" after the attachMovie returns "undefined".
I looked everywhere on the internet and couldnt find how to generate a random number that had one decimal place.I am trying to generate numbers between 12.0 and 13.0 randomly.Below is my code... I know its wrong because of Math.round and Math.random, but i cant seem to find anything that deals with a decimal place.
addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler_1); function fl_EnterFrameHandler_1(event:Event):void{volt.text = Math.round(Math.random()*(1)+12).toString();}
i have a swf with a list of images on the left and what i want to do is when i click in the image , it will creat an empty movieclip and send an image inside.i know how to do this, but the problem is that i have a 300x200, 200x300 and another sizes, but the max width and hiehgt is 300x300, so i need a 300x300 movieclip and my dificultie is to make the images stay exactly in the middle of the invisible movieclips o they dotn load around places i dont want to .im trying with this:
creating clips this.createEmptyMovieClip("containerFoto", this.getNextHighestDepth()); containerFoto.createEmptyMovieClip("foto", containerFoto.getNextHighestDepth()); var fotoLoader:MovieClipLoader = new MovieClipLoader();[code].....
in this code the problem is that im notgettting the width and hieght of the image.
i try to implement a preloader for my site but i have the following problems:once the preloader is finished it opens my external swf but this one appears below the preloader and very little in the window (almost smaller than my preloader size)
ActionScript Code: **Error** Symbol=movieclip, layer=Layer 1, frame=1:Line 3: Statement must appear within on handler movieclip.gotoAndStop ("framelabel",random(4)+2); **Error** Symbol=movieclip2, layer=Layer 2, frame=1:Line 3: Statement must appear within on handler movieclip2.gotoAndStop ("framelabel"random(10)+2);
. The AS is on said button within the MC, and the MC has an instance name.This is the AS I'm using. I'm trying to make a randomize button that generates a random frame in my flash file instead of one MC..
ActionScript Code: on (release) { movieclip.gotoAndStop ("framelabel"random(4)+2); movieclip2.gotoAndStop ("framelabel"random(10)+2); }
I am making a flash toy in which the user correctly places an object to its correct base. I've managed to get object preplaced onto the stage to snap to the right base. But now I'm trying to get randomly generate a single object from each array I've made to be placed on the stage and to be placed on the correct base.[code]...
I am trying to make a so called pixel effect in witch I want to make a shape only from pixels that are positioned in some random place on the stage. And all these pixels move to a certain point and create that shape. I've been looking into BitmapData Class but I don't now if that is the best way to do it.
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
I want the press button to detect the last button pressed and if the shapes match, make them do something...obviously. I think I'm going at it the wrong way. I need to stick a "triange" id into the button/mc then if compares that and then if there is a match works then... right?
i'm designing a website in flash8... now i have created some buttons, and i want that when i click on the button stars will fly from them and there will be a sound... i have already created the animation of the stars seperatly and it's in the library, i have also the sound file.... i just can't remember how to put everything together.... when i'll press on the button the stars will be flying from the button and the sound will play?
I place a group of movie clips with random types (different shapes on a square) in a grid formation The code for placing the movie clips is this (this is in two for loops):
[Code]...
this goes up a single column in the grid and should remove the tiles from the stage depending on each type and it does this (sort of) until it tries to remove more than one of the same type. So if it finds and removes an lShapes it doesn't error until it tries to remove another lShapes and then it gives this error in the output: Error #2025: The supplied DisplayObject must be a child of the caller. So I am assuming that this means it thinks all lShapes have been removed and thinks I'm trying to remove something that doesn't exist but there are other lShapes on the stage. I am at a loss as to what to do about this.