SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: modifying tut

  1. #1
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    modifying tut

    Hi,

    I have been messing about trying to adapt a tut I found.... It displays flying words "in space".....Its not far off what I am after and I have very limited flash experience. That said I have learnt a lot over the last week but still am not getting anywhere with this:


    What I am trying to do is to change this from displaying individual words to phrases...

    Could anyone help point me in the right direction?

    ActionScript Code:
    Object.environment = this;

    this.cam = {x:0, y:0, z:500, dx:0, dy:0, dz:-500};

    this.fl = 1000;

    this.createEmptyMovieClip("space",1);

    space._x=300;
    space._y=169;

    this.somewords = "Le vent qui souffle dans mon arbre, dans ses rÍves sa promise, le coeur ŗ l'envers";

    this.wordList = new Array();
    this.wordList = this.somewords.split(" ");

    for (n=0;n<this.wordList.length;n++) {

    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;

    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;

    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();

    kindly,

    lwl

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,551
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    Your key part in this code is where it splits the string on each space to get the individual words

    this.somewords = "Le vent qui souffle dans mon arbre, dans ses rÍves sa promise, le coeur ŗ l'envers";
    this.wordList = new Array();
    this.wordList = this.somewords.split(" ");


    You could just directly define the array of phrases:

    this.wordList = new Array("A phrase in here","instead of of only","single words");

  3. #3
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simplest is often the best

    Hi East Coast,

    Well once again you have proven that more often than not the answer is the most obvious and simplest - which of course I dismissed as not being possible - it couldn't be that easy...... thanking you very much!


Bookmarks

Posting Permissions

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