A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Updating ActionScript to Flash Player 8?

  1. #1
    Member
    Join Date
    Apr 2006
    Posts
    49

    [F8] Updating ActionScript to Flash Player 8?

    I'm really wanting to incorporate this great floating text technique from levitated.net but updating the ActionScript for Flash Player 8 compatibility is beyond my knowledge. Can anyone lend a hand? Tnx.

    Code:
    // register root as environment
    Object.environment = this;
    
    // create camera object
    this.cam = {x:0, y:0, z:500, dx:0, dy:0, dz:-500};
    
    // set environmental constants
    this.fl = 1000;
    
    // create 'space' to which all words will be attached
    this.createEmptyMovieClip("space",1);
    // center 'space' on the stage
    space._x=300;
    space._y=169;
    
    // a string of words related to the wind
    this.somewords = "wind breeze storm stormy tornado text space three dimensional infinite recursive instance object distort environmental atmospheric blow gush whoosh thrash whirl push roar rush caress flow swoop";
    // convert the string of words into an array of words
    this.wordList = new Array();
    this.wordList = this.somewords.split(" ");
    
    // create one instance for each word in the list
    for (n=0;n<this.wordList.length;n++) {
    	// pick a word from the list
    	var word = Object.environment.wordList[n];
    	var x = random(600)-300;
    	var y = random(337)-169;
    	var z = random(Object.environment.fl*2)-Object.environment.fl;
    	
    	// create an instance of the SpaceWord object
    	nombre = "word"+String(depth++);
    	initialization = {txtword: word, x: x, y: y, z: z};
    	space.attachMovie("spaceWord", nombre, depth, initialization);
    }
    
    this.onEnterFrame = function() {
    	this.cam.dz+=.5;
    	// move the camera to its destination
    	this.cam.x+=(this.cam.dx-this.cam.x)/10;
    	this.cam.y+=(this.cam.dy-this.cam.y)/10;
    	this.cam.z+=(this.cam.dz-this.cam.z)/30;
    }
    
    stop();

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    To make it work in AS2...

    Initialize the depth variable, before it's used in the for...loop.
    Code:
    var depth = 0;
    Change 'txtword' to 'txtWord' in this line...
    Code:
    initialization = {txtWord: word, x: x, y: y, z: z};
    HTH

  3. #3
    Member
    Join Date
    Apr 2006
    Posts
    49
    Ahh, that's excellent. I really appreciate the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center