Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member zionlocke's Avatar
    Join Date
    Jan 2003
    Location
    .: l33t Basement :.
    Posts
    736
    Member #
    483
    Liked
    3 times
    If you've wanted to make any number of text fields in flash at a dynamic rate, you've come to the right place. My friend and I have been working on this problem today. We have discovered a grand solution to a difficult issue. Our goal was to create a tree diagram in flash to organize meetings for a student organization on our campus.

    A TextField is normally created in flash with this:
    Code:
    //for handling a loop of a lot of objects
    tempLooper = 1;
    
    //string for the instance
    testString = "instanceName" + tempLooper;
    
    //levels for each field must be different make it increment for dynamic creation
    level = 1;
    
    //x position
    x = 10;
    
    //y position
    y = 10;
    
    //width
    w = 300;
    
    //height
    h = 30;
    
    //create the field from the variables above
    _root.createTextField(testString, level, x, y, w, h);
    Now that we have everything defined, let's come to the main point of this tutorial. I soon recognized that the textfields were stored in some kind of an array. I was searching for a good while until I ran across a tiny little piece of code. I could call the object by its name in a weird way. If you name all your textfield objects with "name" added to an integer, you may gain access to that textfield with the same string by doing the following.


    Let's say we've run the code above. Now what we can do is this:
    Code:
    //for handling a loop of a lot of objects
    tempLooper = 1;
    
    //string for the instance
    testString = "instanceName" + tempLooper;
    
    //root is the array for any instanced object
    _root[testString].text = "new string added";
    You can also use this instead of root:
    Code:
    //this can be used instead of root for any movie that isn't root
    //you may also be able to grab according to movie names
    this[testString].text = "another replacement";
    I hope this has been a useful tutorial, and I hope you enjoy flash's l33t way of handling instanced objects.
    Cheers, zionlocke :chinese:
    Links: Zion Creation | Blog

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    nice work


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:21 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com