ActionScript 2.0 :: Generating Starfield That Can Be Parallaxed With Mouse?
Sep 7, 2007
Is it possible to generate a starfield that can be parallaxed with the mouse? Star is a movieClip in my library which is set to export with actionscript
Current code to generate a static starfield
//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++)
[Code] .....
View 4 Replies
Similar Posts:
May 12, 2010
I want to make a background in an animation that looks like stars going by as a spaceship flies forward.I would like to make stars appear in the distance and then zoom by, very much like the windows screensaver that shows a black screen with stars continually moving toward the viewer.
View 3 Replies
Jun 1, 2011
I'm trying to implement a dynamic starfield into the game blaster mines (chapter 11) from the book "The Essential Guide To Flash Games" (from Jeff and Steve Fulton) but had no success yet. I built a separate starManager.as class and a BasicBlitArrayStar.as class for it. Also I'm using a pool for inactive and active stars (basically I think it's the same method when building the projectiles or rather particles except that the stars move only when the mouse moves (using the same direction).
If u don't know what I mean check out the parallax starfield from [URL]:
freeactionscript.com/2010/06/endless-starfield-parallax-scrolling
Currently it's not working. The inactive pool is full of stars but when I try to draw them on the background I can see absolutely no star. Even when there is an active star available it doesn't draw it on the background. The goal is a starfield that uses similar techniques from the framework like particles and projectiles do. I have some things in mind like getting the child index for creating different star layers but currently I'm not able to realize it properly.
Here are some code excerpts:
starManager.as:
package {
import flash.display.BitmapData;
import com.framework_mod.src.BlitArrayAsset;
import com.framework_mod.src.BasicBlitArrayStar;
[Code] .....
View 1 Replies
Jul 10, 2004
im tryin to rotate this movieclip of a starfield but when i use _rotation i get this flickering effect every second or two of rotation see [URL] left and right keys change rotation hold down a key and you will see what i mean ,is there a way to prevent this flickering here is the code i used
[Code]...
View 1 Replies
Jan 16, 2009
I'm trying to make 3 sliders that, depending on each other, changes the value of a text-box.
Example, If Slider A moves to 150, the value in the text-box changes to 150.
If you then move Slider B to 40, the value in the text-box changes to (150+40) 190.
Same thing for Slider C.
So basically I want the value of what you select in each Slider to be added together in real time like this:[URL] Only this shows just one slider, and I want three, added together
View 1 Replies
Nov 9, 2009
I have an FLV file but need to generate an SWF to then upload onto the internet (with a play/stop bar)
I have no idea how to do this. Is there a step by step I can access or can someone point me tell me where and what to do!!!! I have CS4
I understand that I need to have all the files in the same folder and then link them all in. I will be uploading onto the website (back of house html) is there a basic code that i can modify that will suit my needs?
View 5 Replies
Feb 11, 2003
I want 16 numbers generated in a row, like a credit card
3456 6765 4564 3453
Is there a good way to do that? The card would generate The numbers when it's loaded.
View 2 Replies
Mar 18, 2009
What I'm looking for is to have a button on the screen. When clicked it will generate a random fact. I'd like to have around 25 facts, although the number doesnt matter at this stage.
I'm only learnigng flash and actionscript at the moment so my thoughts are a bit confused. Would I store all the facts in an array and use the math function to generate a random number that will access the fact stored in the array? not sure how the code would look like.
View 2 Replies
Aug 9, 2009
I'm trying to dynamically create links from data in a JSON file.
I can load the JSON file and extract the data, but I'm not sure how to keep track of which URLs go to which titles.
For example, I create a text box and put the words "AOL Homepage" in it and another that says "Google Homepage". I know their respective URLs are [URL] and [URL], but how do I store that information so that when someone clicks on "AOL Homepage" it knows to take them to [URL]
I considered creating a dictionary that stores Titles and URLs so that whenever someone clicks "AOL Homepage" it looks that up in the dictionary and sees [URL]. However, if there are two equal titles, this method will not work.
View 3 Replies
Aug 31, 2009
This line of code is generating codes for other keys but not the Enter Key trace("key code: : " + e.keyCode); It's like AS3 doesn't know there is such a key. The code should be 13 but on my system according to AS3 it doesn't exist. I'm usind CS4 is this a CS4 bug?
View 2 Replies
Aug 2, 2011
i am writing a class for button bar and encapsulating it into main file when i call the setter an object should generate ex:
var s:ButtonBar = new ButtonBar();
s._texts ="kiran";
s._texts = "karthik";
[code].....
View 4 Replies
Dec 15, 2009
Below I have an array that works but it is far too long and I am thinking there is a far easier way to generate the same result using a loop but I just can't get my head around it at the moment. The array is as follows:
var CardDeck = new Array();
CardDeck[0] = new C1();
CardDeck[1] = new C2();
CardDeck[2] = new C3();
CardDeck[3] = new C4();
CardDeck[4] = new C5();
CardDeck[5] = new C6();
[Code]...
View 2 Replies
Mar 3, 2010
In C++ I Can Read The MAC Address Of The NIC and Use It To Generate A Unique Identifier For Each Computer That Interacts With My Web Service. Even If The User Deletes Their Cookies, And Temporary Internet Files, Reformats Their HardDrive And Installs A Different Version Of Windows, That Computer Still Generates The Same Unique ID.How Can I Create Such A Unique Key Using Flex Or Air? The Number Has To Be Either Hardware Based Or Similarly Tamper Resistant.
View 1 Replies
Aug 26, 2010
I am working on a Media up-loader which uploads images to Server. Before start upload file i want to show small thumbnail of Image.
I used Loader class to load image selected by user & used Canvas to draw image on it.
This works fine with images like jpg & png.
But for bmp file loader class doesn't work.
Is there anyway to load bmp image in Flex & Convert it to BitmapData ??
View 1 Replies
Sep 10, 2010
I'm writing a simple html page creator that will generate html code on customized settings. Now i want to add a "Demo" button that will generate a html page on the fly for the user to see the end result.
View 2 Replies
Jan 19, 2009
I want to appear one of a set of colors randomly on timer fire using the below code:
var myTimer:Timer = new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER, timerFunction);
function timerFunction(event:TimerEvent) {
[Code].....
This works to randomly generate a color, but I want to call one of a set of colors. this.graphics.beginFill only takes a numeric value or a fixed color value.
How would I add the var here to activate my set?
var myArray:Array=new Array("0x000000","0x0000FF","0x00FFF0","0x0FFFFF") ;
var i:int;
for(i=0;i<myArray.length;i++){
View 2 Replies
Sep 17, 2009
This is my actionscript problem (AS2)The aim if this script is to load images from a xml, show them on screan, and when clicking on one of them, show the big one. I know there are a lot of ready-made scripts, but as I would like to learn AS, I try to do it myself....Now the problem actually is the onRelease... in this example whatever the picture i clic, I always get: "clicked on image: 5" as output.. (when 5 images are loaded...)
ActionScript Code:
//////////////////////////
//PARAMETERS
//////////////////////////
espacement = 10;//l'espacement en px entre les images
[code]....
View 1 Replies
May 5, 2011
I have an engine for platformer game and I need to generate random blocks while moving and of course delete old ones, when the hero leave pervious position.Here is the code for generating random platforms when the game starts (costructor):
ActionScript Code:
public function TheGame()
{
bla-bla...
[code]....
As you can see, I create a loop which creates 10 platforms in different positions.My goal is to create a function which will delete blocks from the array which are not in the stage anymore and create new blocks when screen is moving up.
View 2 Replies
Jun 23, 2010
I was wondering if anyone could enlighten me as to how I could generate a rectangle movieclip on top of the longest section of a frame of a movieclip using AS3?
If this is the movieclip frame, I want it to find the longest portion of the movieclip on the right.
And then generate a rectangular movieclip on the longest section of the frame on the right side.
(Don't mind the white bg, I just used paint quick, it won't be there)
I can figure out how to generate the rectangle and all of that, but I am confused as to how I could determine the length of the longest portion of the movieclip, and how to tell AS3 to place it there.
View 9 Replies
Sep 28, 2003
I'm having trouble generating a random number between 1 and 4.
My script looks like this;
[Code]...
View 7 Replies
Feb 2, 2011
I Have started to learn AS3 from scratch and have decided to create a simple maths game for small children. The game consists of multiplication and division. I have everything working accept for this one last thing that I'm just not sure how to tell Flash what to do. Basically there are 2 text boxes that randomly generate a number between 0 and 12. The 3 box is where the user enters their answer. They press check and the code checks to see if box 1 divided by box 2 equals box 3.
However what I want to do is ensure that only whole numbers are used and that the number can actually be divided. I told I need to use this method but I don't know how to implement this in Flash AS3. "For division, the trick is to generate the question, but make sure that the product of the two random numbers is actually displayed in the first box (product / rand1 = rand2) otherwise you get difficult sums..."
Here is my current code:
function divSetup(){
displayRandomDivNumber();
}divSetup();
var divQuest1:String;
var divQuest2:String;
[Code] .....
View 4 Replies
Jan 11, 2005
hi, i'm generating two random numbers, between 1 and 4, which must be different to each other each the two numbers are picked. i've tried the following:
var firstRandom = Math.random()*3+1;
var secondRandom = Math.random()*3+1;
var boxA = "box"+(Math.round(firstRandom));
[code]....
and i still get two numbers the same occasionally. why isn't it comparing the numbers?
View 1 Replies
Oct 6, 2008
I want to know if it is possible to create a vector based file (PDF) from a web based Flash application. The application would be a 'Design it yourself' type deal, it would just be a fancy text generator. All this will be designed by the user using the flash application.What I want to know is once the user has finished designing their text, can this 'creation' then be exported as preferably a PDF, or Jpg, etc. once the user submits the design?
View 3 Replies
Jan 10, 2009
generating random numbers between 50 and 200 but the number that has been generated once should not be displayed again. I am using this code
var num:Number;
on(release){
num = Math.round (Math.random ()*200);
trace(num+50); // +50 because random numbers between 50 and 200 are required
}
Its working fine but sometimes repeat the number that has already been displayed.
View 4 Replies
Feb 19, 2009
I need to make a random number series something like " LK208T38". I can make single random number but dont know how to produce a series. May be we can store the characters in array and display them.
View 3 Replies
Jan 20, 2010
I am making a game where random letters and words are generated into movieclips, thats the background. I built it using arial as my font, however I then decided to go with a fixed width font to make sizing the movieclips to the words much more straightforward. Yesterday this worked fine, the font i am using (Liberation Mono) is installed on my computer, all the textboxes which use this font have the character embedding on them, and I have not changed any of the movieclips, only non-relevant code. So I run it up again today and none of the words appear. Thinking it might be some code changes I made I go thourhg tracing out everything, only to find the wrds are being generated, and written to the textbox absolutely fine. I switch back to Arial just as a check and bang it works again.
View 1 Replies
Nov 10, 2010
this time i want to create a flash movie with about 150 pages that has in all of them a single form (input Text field) and then exports it to mysql database via php file. now my problem is this. how the hell can i tell as2 to build the textfield on each and every frame. onenterframe just keeps looping 12fps on the same frame.
Code:
//MASTER LOOPER!!!!
onEnterFrame = function () {
_root.frameNumber = _root._currentframe;
[Code]....
View 1 Replies
Sep 7, 2009
[url]...He creates a movieclip called aPuff and then gives the movieclip an identifier of aPuff as well. It generates a smoke-like effect which is really nice; however, I'm wanting to get it to stop at some point...preferably by allowing the last puff to go up and fade out.[code]...
View 1 Replies
Jan 21, 2010
I'd like to create a very simple random addition equation.I have: 3 dynamic text boxes (r1_txt, r2_txt, a1_txt)I want the first two to be random numbers and "a1_txt" to display the sum of the first two random numbers.Everything's perfect up to the point of adding the two numbers together and dropping the answer into a1_text. What do I need to do to my last line of code?
//random numbers//1.function randomNumbers(min:Number,max:Number) { var Results:Number=Math.floor(Math.random()*max)+min; return Results;}
//2.new_mc.addEventListener(MouseEvent.CLICK, showRandomnumber);
//3.function showRandomnumber(event:MouseEvent):void{ r1_txt.text = randomNumbers(1,100) r2_txt.text = randomNumbers(1,100) a1_txt.text = Number(r1_txt.text) + Number(r2_txt.text);}
View 3 Replies
Oct 5, 2011
I m doing a project and had an idea of doing a math game thing where numbers are randomly generated in two slots. For example one is between 1 and 100 and the other the same, and then adding them together. The player would have to add them together then type them into the the answer box and it would tell if it was correct or not. I need help with the coding as I am new to CS5.I have worked with an older, outdated version of flash a little over a year ago. So I somewhat know general things and some of the things that need to be done. Actionscript though is pretty new and I was trying to use math.Random because thats what it seems like everyone is using in their tutorials. Yet, I couldn't get it to work when playing around with it.
View 8 Replies