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
    .: l33t Basement :.
    Member #
    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:
    //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;
    w = 300;
    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:
    //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:
    //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


  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Boston, MA
    Member #
    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 11:38 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: