Moving A MC To A Random Location
I want to move a Movie clip....to a random location on the stage...based on when a user does a mouse over on the Movie clip.
In other words.....if I had a little box...in a movie clip...sitting on the main stage...and you mouse over it...I want it to "slide" to another location...but I want it to be totally random...
What type of code do I use?
Any suggestions would be appreaciated.
Thanks,
Mark
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 10-17-2003, 12:02 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving A MC To A Random Location
two questions actually....
1st...On a mouse over...I want a movie clip to move to a random location on the stage.
2nd...somewhat related...I want to be able to click...anywhere on the stage...and the movie clip goes there.
I know how to do this with "easing"....but I want the movie clip to follow a path...not a straight line.
In other words...if I had a maze....and I clicked somewhere in the maze....the movie clip would follow the maze to the location.
Too much to ask?
Any help would be appreaciated!
Thanks!
Moving A MC To A Random Location
I want to move a Movie clip....to a random location on the stage...based on when a user does a mouse over on the Movie clip.
In other words.....if I had a little box...in a movie clip...sitting on the main stage...and you mouse over it...I want it to "slide" to another location...but I want it to be totally random...
What type of code do I use?
Any suggestions would be appreaciated.
Thanks,
Mark
Random Location For A Random Movie Clip
I have various movie clips which I need to appear in one of four locations randomly. I need the movie clip to also be random. I also need more than one movie clip on stage at the same time. I believe the following needs to be used:
Math.random
duplicateMovieClip
I also believ that the method needs to be generic. Apart from that I am stuck.
Any help/ideas are appreciated.
Hope my question makes sense?
Moving Different Objects To One Location
Howdy, i have the following problem
First Object: x100 y100
Second Object: x400 y400
Thrid Object: x200 y200
when a counter reaches a certain number they all have to move to
x300 y300
how can i do this via AS??
any help
thanx in advance
Moving Flash From One Location To Another
A customer of ours has asked us to copy their existing site as they are unable to get hold of the developer who originally built it and they need to update the site.
We used Httrack and this has copied everything exactly and when I run the site on my machine it runs fine, however when I put the site on our server on a sub domain it doesn't load the flash movie even though it is pointing to the right place
Code:
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/s...s/flash/swflas
h.cab#version=6,0,29,0" width="518" height="104">
value="swf/swf.swf">
<param name="quality" value="high">
<embed src="swf/swf.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="518"
height="104"></embed></object>
Moving Site To New Location But Always Looks At Old Links
I have made a site in dreamweaver with a flash navigation bar.
Clicking on a button in the flash nav bar loads a new html page below it.
However, when I transfered the whole thing from my drive to the internet the buttons were still looking on my hard drive for the pages.
(macintoshHD/users/jennie/sites/olympus/home.html).
I had to go back into Flash and re-do all the links to correspond to the web site address: (www.olympus-automation.co.uk/home.html)
This was fine, but now the client wants to put the site on all his salesman's PDA's but of course the PDA is now looking for the files on the Internet even though they're all stored in it's memory.
Is there any way of making the files work in the same way that Dreamweaver does? Dreamweaver is intelligent enough to figure out that when you move a site to a new location, all the relevant files have moved with it....
Any help would be appreciated as I'm in the brown sticky stuff - big time!
Jennie Flowers
Alive Studios
admin@alivestudios.co.uk
Moving (teleporting) A Movieclip To A New Location.
Hmmm, it is late and I am pretty tired out right now. Do you guys know of a way to make it so when a movieclip (The moveable "character" in my side scroller) hittests another movieclip the character is moved (teleported) to a new location? Thanks guys, I really appreciate it.
Moving An Object To Another Objects Location
hi, i am creating a vertical shooter adaptation.
i am trying to create the enemy units to fire in a direction at the main unit.
The problem is that the bullet follows the main unit instead of moving in a straight direction where the unit used to stand.
I am using timers for creating the animation and i have tried changing the rotation of the bullets. I have got it to rotate in the direction i want it to but it doesnt move there.
i am also trying out this temp object thing where an object is left at the main units last location and the bullet travels to that location. its not working yet but i am going to give it another try.
Duplicating Mcs And Moving To A Specific Location
hi in this fla i have a square duplicating it self going to the right when it reaaches a certain value it goes down one "line" the problem is when it goes down it won't duplicate and move the _x value.. or something like that ...check the fla
any help really really appriciated!!
thanks ahead, z00m
Moving Clips To Specific (x,y) From An Unknown Location
Okay Flash Gods... I have a clip that is floating about the stage... now when I release a button I want the clip to travel to a specific point on the stage... by travel I mean I want to see the clip move to the point.. not immediately appear to it.
I'm using Flash MX (not 2004)
-Pez
Random Location
hi guys,
I am making the following movieclip
several buttons and a plane which flies above a map.
I want to following to happen
I click on button 1 and the plane goes to location 1
I click on 2 and the plane goes tol ocation 2
I click on 3 and the plabe goes to....yes to location 3
I click on 4 and the plane goes to location 4
I click on 5 and the plane goes to location 5
etc..
it's easy to make if the user will use the buttons from 1- 5. Unfortunately this is not going to happen...the user will go from 1-3-2-1-4-3-5 or something.
But I want the plane to fly to the correct location...from every point
Unfortunately I have NO clue on how to start...I downloaded MX trial version now ( i have Flash5 experience, but i am not a good programmer)
Can somebody help me on the way?
Thnx!
Joris
PS. if somebody has a wordl map that is vector based and is willing to share it with me....please let me know, still looking for it
Random Location
how do you make a movie clip appears at random location and time?
Random Location, But Not Overlapping?
I have a game that scatters letters around the stage and users have to use the arrow keys to move something around grabbing the letters in order.
This all works just dandy, but sometimes the letters over lap.
Is it possible to have them scattered randomly, but then move a bit more if they are touching another MC? Or just not stop if they are touching another MC?
I also want to build in some obstacles in the future and don't want the letters overlapping the walls and what not. I could prevent them from landing on the outer walls, but not things in the middle.
Move To A Random Target Location
hi!! i'm using flash five and i need some help with making the following happen.
a movie clips actions:
loop
pick a random number with math.random for x
pick a random number with math.random for y
loop:
head towards x and y one pixel at a time
until -> has reached x and y, then
loop
please excuse my crappy psuedo code, hope someone can help!
Problem Generating Mc In Random Location
I made a button with the following actionscript:
on (release) {
amount = 50;
while (amount > 0) {
duplicateMovieClip(_root.box, "box"+i, i);
setProperty ("box"+i, _x, random(275));
setProperty ("box"+i, _y, random(275));
setProperty ("box"+i, _xscale, random(50));
setProperty ("box"+i, _yscale, random(50));
i++;
amount--;
}
}
The point was so that when you clicked on the button it would randomly generate a movie clip of a falling box, in random locations and sizes. This code is pulled directly from flash's reference guide. I'm not sure what I'm doing wrong, but the clip is not generating.
Random Movies That Change Location
I'm trying to create a movie effect. I would like the movie to appear at a location then appear at a different location then appear at another location. Can anyone help? My code is:
this.attachMovie("movie1", "newMovie", 1);
this._X = 10;
this._Y = 10;
this.attachMovie("movie1", "newMovie", 1);
this._X = 20;
this._Y = 20;
Load Mc Into Random Stage Location
Hello,
I want to load a movie clip into a random location on a stage that is 1024 x 768... yes a screen saver... but I am not sure how to go about specifying random stage placement..... Can anyone help me out?
Thanks ahead of time for your help... JK
Load Mc Into Random Stage Location
Hello,
I want to load a movie clip into a random location on a stage that is 1024 x 768... yes a screen saver... but I am not sure how to go about specifying random stage placement..... Can anyone help me out?
Thanks ahead of time for your help... JK
MC Duplicate With Random Location In Set Range
Hey all!
Im having a bit of a problem with duplicating a movieclip.
Im an AS noobie, so dont kill me for stupid mistakes lol.
Heres what im trying to do:
I have a button, when the <Insert> key is pressed and if the variable money at root is higher or equal, then make the variable "vpill" equals 1 and duplicate the MC "pill".
Heres the code i have for that:
Code:
on (keyPress "<Insert>"){
if (_root.money >= 1000){
_root.vpill = 1;
_root.money -= 1000;
duplicateMovieClip(_root.pill, "pill"+1, _root.pill);
}
}
As for the MC "pill", what i want is if the variable "vpill" equals 1 then at a random location (in a set range), place the mc, and if hitTest is true with "player" then _root.speed -= 1; make "vpill" equal 0 and remove the duplicated MC.
Heres the code i have on "pill" MC:
Code:
onClipEvent (load) {
randomNum=function(Minimum,Maximum){
return Minimum+Math.random()*(Maximum-Minimum);
}
if (_root.vpill == 1) {
pillx = randomNum(220, 480);
pilly = randomNum(70, 330);
this._x = pillx;
this._y = pilly;
if (this, hitTest(_root.player)) {
_root.speed -= 1;
this.removeMovieClip();
_root.vpill == 0;
}
}
}
NOTE: Variables are all placed in the root.
Thx in advance!
If u dont understand something, feel free to ask. THX!
Have Random Motion But Ending At A Set Location?
Hi-
Say you have no more than (7) instances of a movie clip about to come on stage. Randomly changing the opacity, scale, and speed of each shouldnt be a problem right? There's plenty of info out there on how to do that.
BUT, how do you get the instances to move randomly (and er, differently) each time the sequence loads, but have them end (or "land") on the exact same spot each time?
ie - move around where ever you want for such-and-such specific amount of frames (or time), but make sure you stop right HERE when you get to the pre-determined end of the sequence.
Thoughts?
Load Mc Into Random Stage Location
Hello,
I want to load a movie clip into a random location on a stage that is 1024 x 768... yes a screen saver... but I am not sure how to go about specifying random stage placement..... Can anyone help me out?
Thanks ahead of time for your help... JK
Import Random Image To Exact Location
I'm using Flash MX and I have 8 pictures, all 150x150 pixels, located in a specific directory, and I want Flash to choose randomly one and put it in an exact coordinates, with linkage if possible. Also, they are all alpha-transparent PNG. Can somebody please answer my question (for once...) and tell me how it is done exactly?
Import Random Image Into Exact Location
I'm using Flash MX and I have 8 pictures, all 150x150 pixels, located in a specific directory, and I want Flash to choose randomly one and put it in exact coordinates, and I want to import them from file and not include them in the library...
(the images are all alpha-transparent PNG)
Can somebody please answer my question and tell me how it is done exactly?
Thanks alot!
Movie Clips In Fixed Location But In A Random Position
When my movie loads I want my 6 movie clips (same shape different size) to be randomly located within a contained area (see dashed line box in attached movie). I would like their vertical centres to be randomly located with this area but there to be even space between each movie clip.
In other words each time the movie loads each movie clip would be in a different (random) position.
Can anyone help?
Thanks
Newtoo
Random LoadMovie Function - Problem With Location Of External SWFs
Hi,
I'm having a problem with embedding a Flash movie that loads an array of SWFs- specifically, ones that exist in the same movie as the .fla loader file.
When I move the external SWFs and .swf load_movie file into a separate directory from the HTML file, they do not load properly. I get just a white window, and am not sure how to solve this .
http://www.calit2.net/newwebsite/ind...nversion3.html
When I keep the SWF movie clips and load_movie.swf in the same (root) folder as the .html file, then everything loads properly, though. But this would extremely clutter up my directory!
The code is as follows:
MOVIE CLIP ON STAGE
Attach Code
onClipEvent(data){
//test to make sure it's completely loaded, when swf's load this way onData is called with each 'chunk' of data
if(bytesLoaded()==bytesTotal()){
this.onEnterFrame=function(){
if(_currentframe==_totalframes){
_root.loadNextMovie()
}
}
FIRST FRAME OF TIMELINE - ACTIONS LAYER
filename = ["agilent.swf", "amcc.swf", "ampersand.swf", "alliance.swf", "analog.swf", "avalon.swf", "att.swf", "archventure.swf", "boeing.swf", "awarepoint.swf", "broadcom.swf", "bigbangwidth.swf", "bluetitan.swf", "butterfly.swf", "broadleyjames.swf", "calamp.swf", "calbatech.swf", "calient.swf"];
loadNextMovie = function () {
trace("loadnext");
movieTarget.loadMovie(filename[random(filename.length)]);
};
loadNextMovie();
}
}
HTML CODE:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="168" height="113" id="load_randomMX" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="load/movie/load_randomMX.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="load_movie/load_randomMX.swf" quality="high" bgcolor="#ffffff" width="168" height="113" name="load_randomMX" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
I 'm not sure if there is a way in loadMovie to specify another folder, or the best way to solve this problem. I'm relatively new to Actionscript.
Any help is appreciated, thanks!
Random LoadMovie Function - Problem With Location Of External SWFs
Hi,
I'm having a problem with embedding a Flash movie that loads an array of SWFs- specifically, ones that exist in the same movie as the .fla loader file.
When I move the external SWFs and .swf load_movie file into a separate directory from the HTML file, they do not load properly. I get just a white window, and am not sure how to solve this .
http://www.calit2.net/newwebsite/ind...nversion3.html
When I keep the SWF movie clips and load_movie.swf in the same (root) folder as the .html file, then everything loads properly, though. But this would extremely clutter up my directory!
The code is as follows:
MOVIE CLIP ON STAGE
Attach Code
onClipEvent(data){
//test to make sure it's completely loaded, when swf's load this way onData is called with each 'chunk' of data
if(bytesLoaded()==bytesTotal()){
this.onEnterFrame=function(){
if(_currentframe==_totalframes){
_root.loadNextMovie()
}
}
FIRST FRAME OF TIMELINE - ACTIONS LAYER
filename = ["agilent.swf", "amcc.swf", "ampersand.swf", "alliance.swf", "analog.swf", "avalon.swf", "att.swf", "archventure.swf", "boeing.swf", "awarepoint.swf", "broadcom.swf", "bigbangwidth.swf", "bluetitan.swf", "butterfly.swf", "broadleyjames.swf", "calamp.swf", "calbatech.swf", "calient.swf"];
loadNextMovie = function () {
trace("loadnext");
movieTarget.loadMovie(filename[random(filename.length)]);
};
loadNextMovie();
}
}
HTML CODE:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="168" height="113" id="load_randomMX" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="load/movie/load_randomMX.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="load_movie/load_randomMX.swf" quality="high" bgcolor="#ffffff" width="168" height="113" name="load_randomMX" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
I 'm not sure if there is a way in loadMovie to specify another folder, or the best way to solve this problem. I'm relatively new to Actionscript.
Any help is appreciated, thanks!
Problems Using Array To Place Movieclips In Precise Location But In Random Order
Hi everyone,
I'm trying to create a memory game for my kids at school (using Flash MX 2004 on a mac). You know where you have to turn over two cards at a time and try and match them. Obviously each time the game is played the cards need to be in a different location. I borrowed a piece of code for randomly loading movieclips without repeating from another file I had asked for help with previously, which worked very successfully. But I'm having problems adapting it to fit my needs.
I have placed empty 24 movieclips on the stage so that I can place the cards in nice neat rows. In frame 1 I used this code:
code: allLocations = new Array();
allLocations.push ("location1","location2","location3","location4"," location5",....etc);
Then on a start button I used:
code: on (release) {
randNum = Math.floor(Math.random()*allLocations.length);
nextLocation = allLocations.splice(randNum,1);
_root.attachMovie("card1","card1",1);
_root["card1"]._x = _root["location" +randNum]._x;
_root["card1"]._y = _root["location" +randNum]._y;
randNum = Math.floor(Math.random()*allLocations.length);
nextLocation = allLocations.splice(randNum,1);
_root.attachMovie("card2","card2",2);
_root["card2"]._x = _root["location" +randNum]._x;
_root["card2"]._y = _root["location" +randNum]._y;
randNum = Math.floor(Math.random()*allLocations.length);
nextLocation = allLocations.splice(randNum,1);
_root.attachMovie("card3","card3",3);
_root["card3"]._x = _root["location" +randNum]._x;
_root["card3"]._y = _root["location" +randNum]._y;
and so on....
This seemed to work at first but when I test my movie things go wrong. The incorrect number of movieclips are placed and sometimes moviecips are placed at (0,0) (where I don't have a "location").
Does anyone have any ideas, please?
Thanks,
Alun
Moving From One Html/swf To An Exact Location In Another Html/swf
Please help.
I'd like to move from one URL that contains a Flash movie to an exact location of another URL's Flash movie. Moving from URL to URL is easy to do, but I'd like to go to a specific location in the new URL. Something like ... from: test.html (which has flash movie) to: whoopdiedoo.html (which has flash movie) and I'd like to immediately go to "frame 20" or to a label called "stuff" or to "Scene 3", "frame 6", within the whoopdiedoo.html Flash movie. Is this possible to get a very specific location in a getURL command? To Help out how about this is used as the example.
Assume I'm presently on ... test.html (test.swf ... and I've released the button in test.swf that will direct me to the exact location of another .swf in a different .html.)
What will the code be to have the On Release of the button direct me to ...
#1) different.html (containing diff.swf and frame 70) or
#2) dfifferent.html (containing diff.swf and Scene 2, frame 70) or
#3) different.html (containing diff.swf and Scene 3, Label of "dog")
Assuming all pages are in the same folder.
Flash MX 2004
Thanks ... Gord
MOVING RANDOM MC's
Ok ... does anyone know how I can :
On click - move a (random) movieclip/button to a certain location (like : x_ 200 & Y_200).
and if the movieclip/button has already been moved - choose another random movieclip/button ( other than the one that's been moved ).
Any help would be appreciated ... thanks !
MC Moving In Random Directions
Hello again. I was wondering what code I would use to make a movieclip travel in any direction it likes. Thanks,
Andy Kessler
http://www.art-barn.com
Moving In One Of Four Random Directions
I was trying to figure out how to move an object in one of four random directions on it's own. Would I use something like this?:
random(3)
if 1
then object._x=-1...
and so on? Thanks for any help
Andy
Random Moving Mc Eats My Cpu
Can someone tell me if this movie eats up your cpu. It takes up like 25% on my xp1800 cpu ... and if i copy and paste the movie a few times, it quickly takes up all 100%
I was wondering if there is anyway to optimize this code.
Click on the bottle to multiply, and see how it eats up cpu. http://babiy.net/reflect.html
You can see the code in http://babiy.net/reflect.txt
Or get the fla at http://babiy.net/reflect.fla
TIA
Random Moving Movieclips ?
hi,
i'd like to make a banner with duplicating movieclips that move from left to right. (all in actionscript)
Can anyone help me?
Random Moving Movieclips ?
Hi,
ok, i start from one movieclip that's on the left of the screen(movie).
when the movie starts playing, i'd like that mc to move from left to right with random speed, plus, the mc should duplicate itself so that mc's always float from left to right continously ...
i've tryed it with motion tweens but it's not a nice effect.
i had a script for this once.
i'm sorry, i can't explain myself any better.
Random Moving Curves ?
Hi there !! thanks for taking the time.
I searched and searched FK for a similar efect
that imitates the Windows screen saver: Mystify
but with curves, but I couldn't find any.
I want to put a randomly moving set of curves
in the background, and I guess it can be made
with some math calculating script so it's
not a heavy animation.
You can get a better idea what kind of pattern
I'm looking for if you check the atached image.
Thanks a lot !!
Moving Random Placed Objects
I have a star movieclip that i want to lets say place 10 of them on the screen at random positions. I then want them to be animated from left to right on the screen.
How would one go about doing this?
Also how would i make it so that when it gets to the end of the right side of the stage it starts at the left side of the stage again and doing this continuously?
Random Moving Circles
I am trying animate the attached image.
Basically I want a bunch of circles to move around randomly inside a box. I think I'd also like them to bounce of the edges of the box so that they are moving in all directions.
The circles will be different sizes so I'm not sure if I need to apply code to each circle size or if there is a scripting way to create randomly sized circles.
Can anyone help me out, or point me in the direction of a good tutorial. I've been animating in Flash for a while but just begining with action script.
Thanks!
Random Moving Ball
Hey all,
I'm trying to write a script that moves a ball all over the stage randomly. I have the ball constructed, functions that create random numbers, and a tween that moves the ball to those random numbers (although it isn't easing which I also haven't figured out why yet). My question, how do I get these tweens to continue to run continuously? My friend had mentioned something about "listening for the end of the Tween and calling that same function again." Basically, what I want is this ball to continue to move to random destinations once compiled.
Here is the code:
Code:
package
{
import flash.display.Sprite;
import flash.events.Event;
import fl.transitions.Tween;
import fl.transitions.easing.*;
public class Ball extends Sprite
{
//Class members
private var myBall:Sprite;
private var theX:Number;
private var theY:Number;
private var theRadius:Number;
private var coordPointX:Number;
private var coordPointY:Number;
//Constructor
public function Ball(inX:Number, inY:Number, inRadius:Number):void
{
theX = inX;
theY = inY;
theRadius = inRadius;
init();
}
private function init():void
{
makeBall();
placeBall();
newNumberX();
newNumberY();
myBall.addEventListener(Event.ENTER_FRAME, moveBall);
//trace(coordPointX);
//trace(coordPointY);
}
//Creates myBall
private function makeBall():void
{
myBall = new Sprite;
myBall.graphics.lineStyle(1);
myBall.graphics.beginFill(0x0000FF);
myBall.graphics.drawCircle(0, 0, theRadius);
myBall.graphics.endFill();
addChild(myBall);
}
//Places myBall at it's starting point on the Stage
private function placeBall():void
{
myBall.x = theX;
myBall.y = theY;
}
//Creates a random X coordinate for the Tween
private function newNumberX():Number
{
coordPointX = (Math.round((Math.random() * 550) - myBall.width));
return coordPointX;
}
//Creates a random Y coordinate for the Tween
private function newNumberY():Number
{
coordPointY = (Math.round(Math.random() * 400));
return coordPointY;
}
private function moveBall(inEvent:Event):void
{
var moveToX:Tween = new Tween(myBall, "x", Regular.easeOut, coordPointX, coordPointX, 2, true);
var moveToY:Tween = new Tween(myBall, "y", Regular.easeOut, coordPointY, coordPointY, 2, true);
}
}
}
Random Moving Circles
I am trying animate the image in the supplied link.
Basically I want a bunch of circles to move around randomly inside a box. I think I'd also like them to bounce of the edges of the box so that they are moving in all directions.
The circles will be different sizes so I'm not sure if I need to apply code to each circle size or if there is a scripting way to create randomly sized circles.
Can anyone help me out, or point me in the direction of a good tutorial. I've been animating in Flash for a while but just begining with action script.
Thanks!
sample image
Random Moving Objects
Hi!
This is example of what I have now: EXAMPLE
Here you see, that those red things move from UP to bottom in two different ways (right, left) in 1280x1024 area.
Now I need someone, to change the code, so those red thingys will move only one way (right) from bottom, to right-UP corner.
With best regards,
Joze
Attach Code
init = function () {
width = 1280;
// pixels
height = 1024;
// pixels
max_snowsize = 10;
// pixels
snowflakes = 50;
// quantity
for (i=0; i<snowflakes; i++) {
t = attachMovie("snow", "snow"+i, i);
t._alpha = 30+Math.random()*60;
t._x = -(width/2)+Math.random()*(1.5*width);
t._y = -(height/2)+Math.random()*(1.5*height);
t._xscale = t._yscale=50+Math.random()*(max_snowsize*10);
t.k = 1+Math.random()*2;
t.wind = -1.5+Math.random()*(1.4*3);
t.onEnterFrame = mover;
}
};
mover = function() {
this._y += this.k;
this._x += this.wind;
if (this._y>height+10) {
this._y = -20;
}
if (this._x>width+20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
} else if (this._x<-20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
}
}
init();
Edited: 05/01/2008 at 08:40:30 AM by Bajs0r
Random Moving Words
Hello All!
I'm about 2 hours into ActionScript 3 ... and to flash.. haha! I'm trying to have words move/appear randomly in different locations and I found some code online for something that is very similar to what I want but it is in AS2. Can someone please help me translate. I've started attempting a translation but I think a pro would do it better. If you need the translation I've got so far I can post it later.
This is the AS2 code:
for(i=0;i<5;i++) {
var t = this.attachMovie("ball","ball"+i,i);
t._x = Math.random()*450;
t._y = Math.random()*400;
t.dx = Math.round(Math.random()*450);
t.dy = Math.round(Math.random()*400);
t._xscale = Math.random()*300+40;
t._yscale = t._xscale;
t.onEnterFrame = mover;
}
function mover() {
this._x += (this.dx-this._x)/2;
this._y += (this.dy-this._y)/2;
if(Math.round(this._x) == this.dx) {
this.dx = Math.round(Math.random()*450);
this.dy = Math.round(Math.random()*400);
}
}
Random Moving Squares
Found this flash sample and i can't figure out how to do the random and continuous dancing squares.
I just think that its a random, continuously scrolling image
http://www.mix-fx.com/balancedshakecasual.htm
It's pretty similar to the link summary from kirupa.com found on top of each link page such as this:
http://www.kirupa.com/developer/flash5/home.htm
without the mouse cross
BTW, i'm using flash 5 right now
Random Moving Biohazard
It isn't really a biohazard symbol but i guess it sort of looks like one. 3 points move randomly that are curved to. Here are the files
Random Moving Fly In Menu
hey experts out there, will need some help to figure out what kinda script i should use to achieve a smimiliar effect like this website.Your help will be very much appreciated!
http://www.finish.tv
Random Moving And Stopping...
I've instituted the code for random movement from this tutorial - http://www.kirupa.com/developer/actionscript/random.htm
Does any know of away that I can modify this so when the user rolls over one of the movieclips it will stop moving and once the user rolls offs it will resume random movement.
Thanks in advance.
How To Move An Object Slowly And Smoothly From Location 1 To Location 2?
Hi,
I am new to ActionScript. I wish to use ActionScript to move an object slowly and smoothly from location 1 to location 2.
I learned that I can use the following to move an object to location 2 (x2, y2):
mThisObject.x = x2;
mThisObject.y = y2;
However the object just "swift" from location 1 to location 2, not moving slowly and smoothly from location 1 to location 2.
Could some experts here provide a guideline for me?
Thanks and best regards
Alex
Random Moving Text (like Boids)
Hi,
I'm pretty new to flashmx. I wanted to hear some pointers and tips for an effect:
I want to create text that flies through a frame in random directions. The text starts out of individual letters say {f,l,a,s,h,m,x} is my array of letters.
When two letters collide in flight, they should combine. so if f meets l, it forms fl. They can only combine if they match the targetword (flashmx) and they should bounce if they don't combine.
When the letters combine, I want to show a little local flash.
Furthermore, There are more letters than just the letters from one word. After a while Randomly floating titles (flashmx) should be flying over the screen.
there must have been similar projects. If you can help me with code, or point me to some example code, it would be perfect! It's probably important to plan this right since there's so many ways to do this.
cheers,
komakino
Need Some Help, Moving Symbol Random In Movie
I have a symbol on the main stage that i would like to move, all over at random. I have tried many different things, but not being a great ASer, all ive seemed to create is a great big mess lol.
Can anyone help me out here, kinda bruised my head beating it into the desk.
stage is 750x550
need to move kinda slow like a spotlight type of effect (smooth)
Thx a million
|