How To Move Spacecraft In Starfield
Hi all, please see the following link,
Code: http://www.flashkit.com/movies/3D/En...-850/index.php in this link there is a starfield which moves in different direction according to mouse, Now i want to know how to show a spacecraft moving in this starfield.
Please anyone help me, I am trying this since many days.
Thank you for your time and consideration
Regards Advika
Wish you a very Happy New Year !!! in advance
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 12-28-2005, 04:34 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
- SpaceCraft Doors
- StarField
- STARFIELD
- Starfield
- StarField
- STARFIELD
- Starfield.....
- Blinking Starfield
- A Zooming Starfield?
- Starfield Class
- Starfield/Warp Help Please
- Stop Starfield?
- Interactive Starfield
- How To Make A Starfield?
- Starfield Class
- Starfield Effect
- Parallaxed Starfield
- Stopping Starfield?
- How To Make A Starfield?
- 3d Rotational Starfield - Toughy
- [F8] Starfield-style Game
- How To Create A Blinking Starfield With One Mc
- Reverse Starfield Effect
- Dynamic Starfield Don't Work
- Dynamic Starfield - SetInterval()
- Creating A Starfield Exhaust - Advice?
- Infinite Panning...such As The Starfield Sample
- Generating A Random Starfield With The DuplicateMovieClip
- Starfield Style HitTest Game
- Blinking Starfield Out Of One Mc - The Final Question
- 3d Starfield Problem (based On Senocular's Script)
- Images Move Left To Right, Fast And Slow On Mouse Move...
- Images Move Left To Right, Fast And Slow On Mouse Move...
- Images Move Left To Right, Fast And Slow On Mouse Move...
- Allowing The User To Move Move An Object (graphic Asset)
- Images Move Left To Right, Fast And Slow On Mouse Move...
- Move Movie Clips On Mouse Move (opposite)
- On Mouse Move, Move Movieclip Behind Mask
- Move Movieclip Vertically On Mouse Move
- On Mouse Move, Move Movieclip Behind Mask
- Preloader Progress Bar Not Move In IE, But Move Well In Firefox
- Scene Move = Timeline Move
- Move Mc, Load Ext Swf, Move It Back
- Scene Move = Timeline Move
- MovieClip Move To Here-if Here Move Back
- Move With AS And Move Back Again
- Move On Mouse-move
- Move MC On Mouse Move
- Make One Box Move On Roll Over, Make Other Box Move On Click
SpaceCraft Doors
Hello,
I'm wonder'ing if anyone would help out a Noob. I'm looking for a Flash animation that looks and works like a Spacecraft Door.
I searched this Forum but couldn't find a thread about it so i had to post. I also searched the FlashKit site but didn't find what i was looking for.
Thanks,
~ ed
StarField
For some reason I cant find how to make a starfield like in startrack. Just want to know were a link to that is.
STARFIELD
HELLO
IM TRYING TO MAKE A STARFIELD KINF OF BACK GROUND WERE THE STARS BLAST OF THE MIDDLE
LIKE THE OLD SCREENSAVERS FOR WINDOWS
KNOW ANY TUTORIALS?
Starfield
I couldn't find what i was after with a search (just found syko's really cool starfield) but thats not what im after. If someone can show me an example of some or some links that would be great thanks
StarField
For some reason I cant find how to make a starfield like in startrack. Just want to know were a link to that is.
STARFIELD
HELLO
IM TRYING TO MAKE A STARFIELD KINF OF BACK GROUND WERE THE STARS BLAST OF THE MIDDLE
LIKE THE OLD SCREENSAVERS FOR WINDOWS
KNOW ANY TUTORIALS?
Starfield.....
Guys a on clip event that takes a clip and brings it from very tiny, to close up on the z axis. Say for instance if you wanted to create the illusion of traveling through space. But only use one clip and have it duplicate it self all over at different positions on the artboard.
Ewan, anyone?
Thanks in advance....
www.orlandomediasolutions.com
csatterwhite@orlandomediasolutions.com
Blinking Starfield
i am trying to make a starfield where certain stars blink, and others are stationary and dont do anything
i would like to use actionscript for this - unless someone has a nice, good looking way of doing it through something else
any help would be appreciated
it would also be good to have the stars be in random places and certain random stars will blink, but to a maximum - so say to a maximum of 10 stars, just so that all of them do not blink
also it would be nice if they blinked at different times and different speeds
anyways - sorry to ask so much, i figure if one person doesnt know one part, someone else will, or should
thanks
A Zooming Starfield?
In Flash MX, how could i create a simple starfield zooming past the viewer, as if you were going through hyperspace?
anyone have any ideas how to make the stars appear to be whipping past? and then coming to sudden stop?
if you could respond with as much detail as possible, that would help a bunch.
thanks!
Starfield Class
There's no Source/Experiments section on here, so I figured i'd leave this bit of code with you guys...
I was recently working on a new game www.createage.com/Game/main.html and I needed to get a cool starfield effect, this really isn't a big deal but I figured that you guys could mess around with it, I don't know do whatever you want with it really, the class Definition is as follows:
ActionScript Code:
// put in flash===== var starfield = new Starfield(_root, 300, 5, -1);
class Starfield
{
private var target : MovieClip;
public function Starfield (target : MovieClip, starCount : Number, maxSpeed : Number, dir : Number)
{
this.target = target;
createStars (starCount, maxSpeed, dir);
}
private function createStars (starCount : Number, maxSpeed : Number, dir : Number) : Void
{
for (var i = 0; i < starCount; i ++)
{
var mc;
var dist : Number = Math.round (Math.random () * 100);
mc = target.createEmptyMovieClip ('star' + i, i);
mc.lineStyle (1, 0xFFFFFF, dist);
mc.lineTo (0, 1);
mc._x = Math.random () * 550;
mc._y = Math.random () * 400;
mc.speed = (dist / 100) * maxSpeed;
mc.onEnterFrame = function ()
{
if (dir >= 0)
{
this._x += this.speed;
if (this._x > 550)
{
this._x = 0;
}
} else
{
this._x -= this.speed;
if (this._x < 0)
{
this._x = 550;
}
}
}
}
}
}
You guys should know how to use it , anyway enjoy.
... oh yeah if you use this, the dots are WHITE so set your background to a dark color.
-Michael
If you don't know how to use it, just ask one of us will help you.
Starfield/Warp Help Please
hey,
im having a lot of trouble trying to convert the code for this starfield...
http://www.actionscript.org/showMovie.php?id=569
problem is its in actionscript 1.0 whereas the application i need the warp in, is in actionscript 2.0. Im just not versed enough in knowing the differences in 1.0 and 2.0 to make a real difference...
I would really appreciate someone helping me out on getting this same effect on 2.0, thanks!
Stop Starfield?
I downloaded a starfield movie from this site and it works perfect. My only problem is Im trying to make the starfield play for only 10 seconds. Here is the code that makes the starfield:
Code:
var maxY = 725;
function star (){
this.Dot._xscale = this.Dot._yscale = 10;
this._rotation = Math.round(Math.random()*360);
this.scal = .5;
var r = Math.random()
this.scalFact = 1+r/3;
this.Dot._y = maxY-r*maxY;
}
star.prototype = new MovieClip;
sp = star.prototype;
sp.onEnterFrame = function(){
this.scal*=this.scalFact;
this.Dot._xscale = this.Dot._yscale+=this.scal/3;
this.Dot._y+=this.scal;
//width of starfield
if(this.Dot._y>400){
this.removeMovieClip();
}
}
Object.registerClass("Star", star);
function makeStar(){
for(i=0; i<Math.random()*5+3; i++){
++starCount;
attachMovie("Star", "Star"+starCount, starCount, {_x:350, _y:200});
}
}
starGen = setInterval(makeStar, 10);
How do I make it stop or clear after 10 seconds? Right now it just keeps looping the whole movie and the stars just keep coming.
Interactive Starfield
Hi everyone,
wondering if anyone can help me? I want to create a starfield. This I can do, simple motion toward the screen I can do, and its easy enough to use actionscript to apply a mouse control that changes the speed
However:
I want to be able to move the mouse left and right and the illusion of travel adjust to that particular direction. So like controlling a space craft travelling through space.
Can anyone help me in how to achieve this effect. If you would like an example of what effect I mean please visit this site:
www.amontobin.com
the animation in this field excursion is what I looking to achieve. I have Swift 3D if thats any help.
Thanks very much for the help and time
Sussex Tech
How To Make A Starfield?
I just can't seem to recreate the starfield effect.
My stars are either too big or blotchy and my animation just keeps
jumping about.
Can someone help me please?
Ta
Starfield Class
Hey guys, I was recently working on a new game www.createage.com/Game/main.html and I needed to get a cool starfield effect, this really isn't a big deal but I figured that you guys could mess around with it, I don't know do whatever you want with it really, the class Definition is as follows:
PHP Code:
// put in flash===== var starfield = new Starfield(_root, 300, 5, -1);class Starfield{ private var target : MovieClip; public function Starfield (target : MovieClip, starCount : Number, maxSpeed : Number, dir : Number) { this.target = target; createStars (starCount, maxSpeed, dir); } private function createStars (starCount : Number, maxSpeed : Number, dir : Number) : Void { for (var i = 0; i < starCount; i ++) { var mc; var dist : Number = Math.round (Math.random () * 100); mc = target.createEmptyMovieClip ('star' + i, i); mc.lineStyle (1, 0xFFFFFF, dist); mc.lineTo (0, 1); mc._x = Math.random () * 550; mc._y = Math.random () * 400; mc.speed = (dist / 100) * maxSpeed; mc.onEnterFrame = function () { if (dir >= 0) { this._x += this.speed; if (this._x > 550) { this._x = 0; } } else { this._x -= this.speed; if (this._x < 0) { this._x = 550; } } } } }}
You guys should know how to use it , anyway enjoy.
... oh yeah if you use this, the dots are WHITE so set your background to a dark color.
-Michael
Starfield Effect
does anyone know how you'd do something like the old "starfield screensaver"... you know where it looks like you are flying through space and the stars are passing you? anyone have any ideas or can maybe point me to a good tutorial that would help?
Parallaxed Starfield
Is it possible to generate a starfield that can be parallaxed with the mouse?
if so, can someone help me code this or send me in the right direction. thanks!
NOTE: star is a movieClip in my library which is set to export with actionscript
current code to generate a static starfield
Code:
//import mx. :: I don't recall this exact line of code, but it imports the mx Tween class
import mx.Transitions.*;
var stars:Array = new Array();
var MAX_STARS = 250; // how many stars are allowed on stage at once
var MAX_STAR_SCALE = 4; // the maximum size of a star
for(var i=0; i<MAX_STARS;i++)
{
// draw a new star on stage
newStar = _root.attachMovie( 'star', 'star'+i, i*1000 );
// adjust the star's position on stage
newStar._x = Math.ceil(Math.random()*Stage._width);
newStar._y = Math.ceil(Math.random()*Stage._height);
// resize the star to create false distance
// our star can be a maximum of 4 times the original star's size
newStar._width = newStar._width*Math.floor(Math.random()*MAX_STAR_SCALE);
newStar._height = newStar._height*Math.floor(Math.random()*MAX_STAR_SCALE);
// fade the star out and in as the mouse falls over it
newStar.onRollOver = function()
{
// create the tween
t = new Tween( this, "_alpha", Regular.easeIn, 0, 100, 1, true );
t.continueTo(0, 1); // fade out
t.continueTo(100, 1); // fade in
}
// just for fun, we can make the star explode when clicked
newStar.onRelease = function()
{
// explode the star
scaleY = new Tween( this, "_height", Bounce.easeIn, 0, 100, 1, true);
scaleX = new Tween( this, "_width", Bounce.easeIn, 0, 100, 1, true);
scale = Math.ceil(Math.random()*100);
scaleY.continueTo( scale * this._height, .5 );
scaleX.continueTo( scale * this._width, .5 );
// fade and die
fade = new Tween( this, "_alpha", Regular.easeOut, 100, 0, 1, true);
fade.continueTo( 0, 2 );
// take the star out of memory
unloadMovie(this);
}
// add our new star to a storage container for later use
stars.push( newStar );
}
Stopping Starfield?
Hi
Is it possible to stop a starfield after one frame? I followed this tutorial http://www.flashninjaclan.com/tutorialpage.php?ID=34 to make a starfield but i only want it on only one frame. at the moment it comes on all my frames and i wanted to know whether this can be stopped.
All help is much appreciated.
How To Make A Starfield?
I just can't seem to recreate the starfield effect.
My stars are either too big or blotchy and my animation just keeps
jumping about.
Can someone help me please?
Ta
3d Rotational Starfield - Toughy
Hi Guys,
Just wondering if anyone has any sugestions for this. I am just starting out making a fully 3d space sim. I have thought about the way I want to go about it in terms of distance etc.
I need to generate a starfield, The player will simply move the mouse to move up, down, left and right moving outward in each direction from the central point.
Mouse Up - will make the stars move down,
Mouse Down - will make the stars move up,
Mouse Left - will make the stars move right,
Mouse Right - will make the stars move left.
I would like to generate these stars randomly using the x and y co-ordinates with the random() command but it isn't nessessary.
Does anyone know how to create this so that when you rotate the screen 360 degrees the patern of stars will return to the pattern first seen, also this would need to work up and down etc...
Well any ideas? I know this might be a tricky one but i'm sure you guys could pull the stop out on this one
//Gary
[F8] Starfield-style Game
Hey, I'm having trouble making a game, and I cant seem to get something working. Here is what I have so far:
http://school.timswildwackyemporium....st/candy1.html
As you can see, When you play Once you catch the stars, they disappear.
As a result, the highest score you can get is one hundred.
I would like to make it so that rather than just delete the movieclip, I can movie it back into the beginning of the starfield.
I did not write the code for the starfield, which is why I'm having such trouble figuring this out.
Heres my code
ON THE FRAME
Code:
stop();
score = 0 ;
_root.attachMovie("count_down", "count_down", 12000, {_x:20, _y:330});
_root.attachMovie("hero", "hero_on_stage", 10000,{_x:200,_y:20});
_root.attachMovie("trail_sprite", "trail_mc", 8000);
trailbitmap = new flash.display.BitmapData(500, 350, true,0x000000);
_root.createEmptyMovieClip("trail", 1);
trail.attachBitmap(trailbitmap, 0);
trail_mc._visible = false;
hero_on_stage._visible = false;
power = .65;
yspeed = 0;
xspeed = 0;
wind = 0.00;
gravity = 0;
upconstant = 0.75;
friction = 0.99;
start_time = getTimer();
countdown = 30000;
hero_on_stage.onEnterFrame = function() {
elapsed_time = getTimer()-start_time;
_root.count_down.time_left.text = time_to_string(_root.countdown-elapsed_time);
if (elapsed_time >= countdown) {
_root.gotoAndStop(5);
_root.count_down.removeMovieClip();
};
if (Key.isDown(Key.LEFT)) {
xspeed = xspeed-power;
}
if (Key.isDown(Key.RIGHT)) {
xspeed = xspeed+power;
}
if (Key.isDown(Key.UP)) {
yspeed = yspeed-power*upconstant;
}
if (Key.isDown(Key.DOWN)) {
yspeed = yspeed+power*upconstant;
}
xspeed = (xspeed+wind)*friction;
yspeed = yspeed+gravity;
if (xspeed>15) {
xspeed = 15;
}
if (xspeed<-15) {
xspeed = -15;
}
if (yspeed>15) {
yspeed = 15;
}
if (yspeed<-15) {
yspeed = -15;
}
this._y += yspeed;
this._x += xspeed;
if (this._x<0) {
this._x += 500;
}
if (this._y<0) {
this._y += 350;
}
if (this._y>350) {
this._y -= 350;
}
if (this._x>500) {
this._x -= 500;
}
_root.trail_mc.trail_sprite._x = this._x;
_root.trail_mc.trail_sprite._y = this._y;
_root.trailbitmap.draw(_root.trail_mc);
trail_rectangle = new flash.geom.Rectangle(0, 0, 500, 350);
trail_blur = new flash.filters.BlurFilter(2, 2, 3);
_root.trailbitmap.applyFilter(_root.trailbitmap, trail_rectangle, new Point(0, 0), trail_blur);
};
MovieClip.prototype.placeInSpace = function(id) {
var ratio = this.focaldistance / Math.sqrt(this[id].z * this[id].z);
this[id]._x = this[id].x * ratio;
this[id]._y = this[id].y * ratio;
this[id]._xscale = this[id]._yscale = 1000 / this[id].z;
if (this[id].hitTest(hero_on_stage)){
_root.score ++;
this[id].swapDepths(10000);
this[id].removeMovieClip();
}
}
MovieClip.prototype.randomPlace = function(id) {
var radius = this.rmin + (this.rmax - this.rmin) * Math.random();
var polar = 2 * Math.PI * Math.random();
this[id].x = radius * Math.cos(polar);
this[id].y = radius * Math.sin(polar);
this[id].z = this.zmin + (this.zmax - this.zmin) * Math.random();
if (this[id].hitTest(hero_on_stage)){
_root.score ++;
this[id].removeMovieClip();
}
}
function time_to_string(time_to_convert) {
elapsed_hours = Math.floor(time_to_convert/3600000);
remaining = time_to_convert-(elapsed_hours*3600000);
elapsed_minutes = Math.floor(remaining/60000);
remaining = remaining-(elapsed_minutes*60000);
elapsed_seconds = Math.floor(remaining/1000);
remaining = remaining-(elapsed_seconds*1000);
elapsed_fs = Math.floor(remaining/10);
if (elapsed_hours<10) {
hours = "0"+elapsed_hours.toString();
} else {
hours = elapsed_hours.toString();
}
if (elapsed_minutes<10) {
minutes = "0"+elapsed_minutes.toString();
} else {
minutes = elapsed_minutes.toString();
}
if (elapsed_seconds<10) {
seconds = "0"+elapsed_seconds.toString();
} else {
seconds = elapsed_seconds.toString();
}
if (elapsed_fs<10) {
hundredths = "0"+elapsed_fs.toString();
} else {
hundredths = elapsed_fs.toString();
}
return minutes+":"+seconds+":"+hundredths;
}
ON THE STARFIELD MOVIECLIP
Code:
onClipEvent (load) {
this.count = 100;
this.speed = 3;
this.focaldistance = 25;
this.rmin = 50;
this.rmax = 1000;
this.zmin = 10;
this.zmax = 300;
for(var i = 0; i < this.count; i++) this.attachMovie("dot", i, i);
}
onClipEvent (enterFrame) {
for(var i = 0; i < this.count; i++) {
if((this[i].z -= this.speed) <= 0) this.randomPlace(i);
this.placeInSpace(i);
}
How To Create A Blinking Starfield With One Mc
I have create one blinking star in a mc.
It´s moving in a circle and blinking and changing colors.
Now I want to create a starfield with blinking stars where every individual
star is moving in a different way.
The problem is, if I copy and past 100 of this mc with my blinking star in the
same timeline (main) Theres no individuality. (I hope you understand my swedish/english).
I know that I can copy an paste the same mc at 100 different frames..but that´s "low tech.
Now then:
How the should the actionscript looks like which manage to solve this problem?
random something...??
I know I can read and learn, but I ´ve been working with this site for over a year now and I have
become halfblind (not really - I use glasses) of reading actionsript all nights long and working
at my regular job from 9 to 5.
The technical stuff It´s in other words not my strenght :wink
Here´s my portfolio site: http://www.goodwill.se
(The actionscripting is done with a lot of help from this forum)
Reverse Starfield Effect
Hey folks i am looking to reverse this effect http://jrgraphix.net/research/flash_starfield.php i want the circles to scale away rather then towards you. any ideas, tips, anything at all -thanks a bunch
Dynamic Starfield Don't Work
Hy
Can u please help me?
My starfield just don't move.
I realy dont know what to do!
please help.
it's urgent
thank you
Dynamic Starfield - SetInterval()
Hello, every. I was wondering why the following code is not working as expected:
ActionScript Code:
var starObj:Object = new Object();
var starDepth:MovieClip = new MovieClip();
var starArray:Array = new Array();
this.createEmptyMovieClip("starfield", 0);
var starMotion:Function = function () {
starObj._x = random(401);
starObj._y = 0;
starObj._height = random(11)+10;
starDepth = starfield.getNextHighestDepth();
starfield.attachMovie("star_mc", starDepth, starDepth, starObj);
starArray.push(starfield.getInstanceAtDepth(starDepth));
for (i=0; i<starArray.length; i++) {
with (starArray[i]) {
if (_y-_height>500) {
removeMovieClip();
starArray.splice(i, 1);
} else {
_y += _height;
}
}
}
};
starInterval = setInterval(starMotion, 30);
- THEORY -
It seems as though every time "splice()" is called, the for statement breaks. This would be fine if what I were dealing with was not graphical, however when the for statement breaks the rest of the movieClips in the array are forgotten and thus do not move. This makes for some very rough motion.
-----
"star_mc" is a movieclip in the library with the identifier "star_mc".
All help will be greatly appretiated.
Creating A Starfield Exhaust - Advice?
I am creating an exhaust from a space ship that dissolves into the site name. I'm trying to figure out the best way to approach this problem. I want the MC to trace the trail of the ship for a while but then eventually to dissolve quickly into the name.
I'm wondering if I should use maths or just do it manually. Unlike interactive duplicate clips, this path will stay stationary.
Any one have any ideas, examples, or tutorials that might give me some ideas?
Thanks
jeff
Infinite Panning...such As The Starfield Sample
I'm trying to create a 360 view of my house to place on my website, and do for a few of my friends. I've been able to manipulate the ActionScript for the Starfield Generator to limit it to only the X-Axis...but I cannot figure out how to place MY image instead of the Starfield...please, if you know how to do this, or to even correctly manipulate the ActionScript to allow for inputting MY image...please...PLEASE let me know. For more detail as to my needs, please email me ASAP...it might be beneficial...
Thanks to any and all that can help me.
Aaron
Generating A Random Starfield With The DuplicateMovieClip
I'm really new to actionscript, and I did this code, but it doesn't do anything...
code:
function addStars() {
nbstars = Math.round(Math.random()*200);
if (nbstars > 0) {
duplicateMovieClip("star", nbstars, "1");
setProperty("nbstars", _x, Math.round(Math.random()*400));
setProperty("nbstars", _y, Math.round(Math.random()*500));
nbstars--;
}
}
addStars();
What's wrong with it? The movie clip's instance name and name are "star" but it doesn't do anything.
Thanks
FleZ
Starfield Style HitTest Game
Hey, I'm having trouble making a game, and I cant seem to get something working. Here is what I have so far:
http://school.timswildwackyemporium....st/candy1.html
As you can see, When you play Once you catch the stars, they disappear.
As a result, the highest score you can get is one hundred.
I would like to make it so that rather than just delete the movieclip, I can movie it back into the beginning of the starfield.
I did not write the code for the starfield, which is why I'm having such trouble figuring this out.
Heres my code
ON THE FRAME
Code:
stop();
score = 0 ;
_root.attachMovie("count_down", "count_down", 12000, {_x:20, _y:330});
_root.attachMovie("hero", "hero_on_stage", 10000,{_x:200,_y:20});
_root.attachMovie("trail_sprite", "trail_mc", 8000);
trailbitmap = new flash.display.BitmapData(500, 350, true,0x000000);
_root.createEmptyMovieClip("trail", 1);
trail.attachBitmap(trailbitmap, 0);
trail_mc._visible = false;
hero_on_stage._visible = false;
power = .65;
yspeed = 0;
xspeed = 0;
wind = 0.00;
gravity = 0;
upconstant = 0.75;
friction = 0.99;
start_time = getTimer();
countdown = 30000;
hero_on_stage.onEnterFrame = function() {
elapsed_time = getTimer()-start_time;
_root.count_down.time_left.text = time_to_string(_root.countdown-elapsed_time);
if (elapsed_time >= countdown) {
_root.gotoAndStop(5);
_root.count_down.removeMovieClip();
};
if (Key.isDown(Key.LEFT)) {
xspeed = xspeed-power;
}
if (Key.isDown(Key.RIGHT)) {
xspeed = xspeed+power;
}
if (Key.isDown(Key.UP)) {
yspeed = yspeed-power*upconstant;
}
if (Key.isDown(Key.DOWN)) {
yspeed = yspeed+power*upconstant;
}
xspeed = (xspeed+wind)*friction;
yspeed = yspeed+gravity;
if (xspeed>15) {
xspeed = 15;
}
if (xspeed<-15) {
xspeed = -15;
}
if (yspeed>15) {
yspeed = 15;
}
if (yspeed<-15) {
yspeed = -15;
}
this._y += yspeed;
this._x += xspeed;
if (this._x<0) {
this._x += 500;
}
if (this._y<0) {
this._y += 350;
}
if (this._y>350) {
this._y -= 350;
}
if (this._x>500) {
this._x -= 500;
}
_root.trail_mc.trail_sprite._x = this._x;
_root.trail_mc.trail_sprite._y = this._y;
_root.trailbitmap.draw(_root.trail_mc);
trail_rectangle = new flash.geom.Rectangle(0, 0, 500, 350);
trail_blur = new flash.filters.BlurFilter(2, 2, 3);
_root.trailbitmap.applyFilter(_root.trailbitmap, trail_rectangle, new Point(0, 0), trail_blur);
};
MovieClip.prototype.placeInSpace = function(id) {
var ratio = this.focaldistance / Math.sqrt(this[id].z * this[id].z);
this[id]._x = this[id].x * ratio;
this[id]._y = this[id].y * ratio;
this[id]._xscale = this[id]._yscale = 1000 / this[id].z;
if (this[id].hitTest(hero_on_stage)){
_root.score ++;
this[id].swapDepths(10000);
this[id].removeMovieClip();
}
}
MovieClip.prototype.randomPlace = function(id) {
var radius = this.rmin + (this.rmax - this.rmin) * Math.random();
var polar = 2 * Math.PI * Math.random();
this[id].x = radius * Math.cos(polar);
this[id].y = radius * Math.sin(polar);
this[id].z = this.zmin + (this.zmax - this.zmin) * Math.random();
if (this[id].hitTest(hero_on_stage)){
_root.score ++;
this[id].removeMovieClip();
}
}
function time_to_string(time_to_convert) {
elapsed_hours = Math.floor(time_to_convert/3600000);
remaining = time_to_convert-(elapsed_hours*3600000);
elapsed_minutes = Math.floor(remaining/60000);
remaining = remaining-(elapsed_minutes*60000);
elapsed_seconds = Math.floor(remaining/1000);
remaining = remaining-(elapsed_seconds*1000);
elapsed_fs = Math.floor(remaining/10);
if (elapsed_hours<10) {
hours = "0"+elapsed_hours.toString();
} else {
hours = elapsed_hours.toString();
}
if (elapsed_minutes<10) {
minutes = "0"+elapsed_minutes.toString();
} else {
minutes = elapsed_minutes.toString();
}
if (elapsed_seconds<10) {
seconds = "0"+elapsed_seconds.toString();
} else {
seconds = elapsed_seconds.toString();
}
if (elapsed_fs<10) {
hundredths = "0"+elapsed_fs.toString();
} else {
hundredths = elapsed_fs.toString();
}
return minutes+":"+seconds+":"+hundredths;
}
ON FIELD MOVIECLIP
Code:
onClipEvent (load) {
this.count = 100;
this.speed = 3;
this.focaldistance = 25;
this.rmin = 50;
this.rmax = 1000;
this.zmin = 10;
this.zmax = 300;
for(var i = 0; i < this.count; i++) this.attachMovie("dot", i, i);
}
onClipEvent (enterFrame) {
for(var i = 0; i < this.count; i++) {
if((this[i].z -= this.speed) <= 0) this.randomPlace(i);
this.placeInSpace(i);
}
Blinking Starfield Out Of One Mc - The Final Question
I have create one tweening star in a mc.
Its´s a bitmap which is blinking and changing colors in a animated circle.
I´ve got one answer from shikozel who´s answered this:
>you need to give your star movie clip a linkage name. lets say star_mc. Then loop 100 times. in each
>loop you attach the >star_mc in a random place on the stage. lets say the width of your stage is
>500wx500h. The code should look like that:
>for(var i:Number=0;i<100;i++){
>star_mc=_root.attachMovie("star_mc","star_mc"+i,_rott.getNextHiestDepth())
>star_mc._x=random(500)
>star_mc._y=random(500)
>}
And the final question is:
Cool, this is the first step- to spread the mc all over.
But I wonder if they can be spread in time. Why?
- So every star is moving and blinking individual in time.
- Now the starfield moving and blinking as a group, where every
star is in the exactly same position in their tweening
process, in time.
(the blinking status is exactly the same for eveyone)
In other words:
How to create a starfield where every star is blinking and
changing it´s colors individual?
:b/]
3d Starfield Problem (based On Senocular's Script)
I have been working with the code from the tutorial on
Scripting 3D in Flash
by senocular .
http://www.kirupa.com/developer/acti...ape_camera.htm
What I am trying to do is add a button on the stage of the starfield mc that causes the camera to zoom back away from the star field ie "cameraView.target.z = -this.z".
I can get the stars to go in reverse just by changing the this.z to -this.z in the selectStar function. However, I cant seem to find a way to add this action to an mc that is stationary on my stage. My overall goal for this clip is to learn how to zoom into an object by pressing on it, then zoom back out to the original cameraView position. I tried just adding this action to my button:
on (press) {
_parent.cameraView.target.z = -this.z;
}
but all that did was stop all motion.
I really want to learn the script for doing dynamic websites like those done by sofake and wefail (i.e. Amplifier.com). I am self taught at flash and am currently going through a few books to learn actionscript, I really want to learn this (not just cut and paste) but I've run into a wall, and being that I'm the only Flash designer I know, it would be amazing if some kind person could lead me in the right direction.
P.S.(the sourcefiels can be downloaded here http://www.kirupa.com/developer/acti..._spaceship.htm )
Thank You for your time
Matt Fenton.
Images Move Left To Right, Fast And Slow On Mouse Move...
I'm looking for a tutorial or example of the effect when you have images all next to each other horizontally and when you roll the mouse oneway they move in the opposite direction and when the mouse is centerd on screen they slow down... Anyone have an example or tutorial of this?
Images Move Left To Right, Fast And Slow On Mouse Move...
I'm looking for a tutorial or example of the effect when you have images all next to each other horizontally and when you roll the mouse oneway they move in the opposite direction and when the mouse is centerd on screen they slow down... Anyone have an example or tutorial of this?
Images Move Left To Right, Fast And Slow On Mouse Move...
I'm looking for a tutorial or example of the effect when you have images all next to each other horizontally and when you roll the mouse oneway they move in the opposite direction and when the mouse is centerd on screen they slow down... Anyone have an example or tutorial of this?
Allowing The User To Move Move An Object (graphic Asset)
I'm working on a Flash presentation that will be an instructional tutorial. I'm teaching users how to navigate a map and I'd like to have them move a ruler or legend to measure distances between two points. Can anyone direct me to a reference source that can help me set this up?
I'm a fairly new Flash user but very eager to learn this technique.
Thanks,
Jerry Marino
Images Move Left To Right, Fast And Slow On Mouse Move...
I'm looking for a tutorial or example of the effect when you have images all next to each other horizontally and when you roll the mouse oneway they move in the opposite direction and when the mouse is centerd on screen they slow down... Anyone have an example or tutorial of this?
Move Movie Clips On Mouse Move (opposite)
Hi.
Does anybody have idea how this thing work (the cirlcles moves)?
http://www.templatemonster.com/flash...tes/15650.html
As well as the button gets closer to mouse when near the buttons.
I cant seem to find here .
Thanks very much.
On Mouse Move, Move Movieclip Behind Mask
people,
an example of my wanted work is on:
www.boss.com
(check an item in the collection)
the photo exactly scrolls behind the mask, how to do this?
i want to implement this, please help?
THNX already!
Move Movieclip Vertically On Mouse Move
Hi, i wondered if anyone would be able to help me.
I want to create the same effect as what is used on the URL below
http://www.jobescalator.com/vacancie...ctive_map.html (scroll over the map)
I want a horizontal bar to move up and down the page as and when my mouse moves.
Can anyone help?
Thanks
On Mouse Move, Move Movieclip Behind Mask
people,
an example of my wanted work is on:
www.boss.com
(check an item in the collection)
the photo exactly scrolls behind the mask, how to do this?
i want to implement this, please help?
THNX already!
Preloader Progress Bar Not Move In IE, But Move Well In Firefox
I have been in this problem for several days. I really got frustrated about it. Pls. anybody can give me some help.
I created a general preloader using movieClipLoader object and draw a progress bar using movieClip. I set the progress bar's progress by setting bar_mc._x = percentage, and created as a swf file. when test it , it works well, when open it using firefox, it still work well, can show the gradual progress in the bar, but if I using IE 6 or 7 to open it, it will not show the gradual progress , just jump from 0% to 100% after the whole file is completely loaded.
I saw a note about progress bar not show graduate progress in Flash Player 9, so I uninstall it and install Flash Player 8 again, it is still like that.
I really don't know what 's the problem. Could any friends give me some suggestion or idea, that will be greatly helpful.
Thanks.
Scene Move = Timeline Move
Hi,
I have found a very inspiring site which made in Flash http://www.burberry.com/UK/History/History.shtml
In the history part, when you mouse over on the scene, it is not only the scene is moving but also the timeline at the bottom.
Anybody can tell me how to do it?
Yours,
Bell
Move Mc, Load Ext Swf, Move It Back
anyone got any ideas on how i could move an mc across my stage, load an external swf once it hits the destination, then move it back to it's original location? i want to do this all in actionscript 1.0, sans tweening if thats possible. i've tried to set up a function for this with if statements and loops based on x position, but i've had no luck.
Scene Move = Timeline Move
Hi,
I have found a very inspiring site which made in Flash http://www.burberry.com/UK/History/History.shtml
In the history part, when you mouse over on the scene, it is not only the scene is moving but also the timeline at the bottom.
Anybody can tell me how to do it?
Yours,
Bell
Move With AS And Move Back Again
I have an mc called knas_mc that i would like to move something like 10 pixels to the left and 10 px up - a diagonal move. Thats not to hard but i want it to move back to its original location after it has "arrived".
I have this code that doesn't work - the problem with it is obvious but it shows what i want to happen:
Code:
MovieClip.prototype.moveIt=function(moveSpeed){
this.onEnterFrame=function(){
if(knas_mc._x<=271 && knas_mc._x>252){
knas_mc._x-=moveSpeed;
//trace(knas_mc._x);
}else {
if(knas_mc._x<=252 && knas_mc._x<268){
knas_mc._x+=moveSpeed;
}
}
}
Move On Mouse-move
peepz i have this script on a movieclip:
Code:
onClipEvent (load) {
_y = 20;
speed = 1;
}
onClipEvent (enterFrame) {
if(_y <= 0 or _y >= 297){
_y += 0
}else{
endY = 320-_root._ymouse;
_y += (endY-_y)/speed;
}
}
my problem is that if the movieclip is on 0 it stops and if i move the mouse it will not start moving again :?
please help?
Move MC On Mouse Move
Hi all . How to move this MCnavigation on mouse move. For example if I move my mouse to the right the MC Navigation text moves to the left and mouse to the left it moves to the right.
Example file: http://lex.zeelex.com/navigation.html
Is there any components can help me move it.
Make One Box Move On Roll Over, Make Other Box Move On Click
Okay here's the story: I have one box that moves the way I want it to on roll over, moves over my nav buttons and stays over them after you click one of them. The clicked button becomes where the box snaps back to. I have another box that I want to stay where it is until you click on a button. If you click on a button the box will move under the button that I have clicked on. Every attempt so far to get the second box to do that usually negates the other box's ability to do anything. Please, any help or suggestions?
|