Skip navigation
ForrestMorgan
Currently Being Moderated

Connecting a .as file to the .fla file

Jul 20, 2009 6:31 PM

I have written my .as file to 'make a scrollbar work with text' but the on line video training missed out the last step.

 

I now have my 'package' defined in my .as file . . . how do I 'link' . . . 'connect' it to my .fla file?

 

Also, wouldn't it be easier just to write the code in the .fla action layer than a .as file???

 

Forrest

 
Replies
  • Currently Being Moderated
    Jul 20, 2009 7:23 PM   in reply to ForrestMorgan

    If you have created a class file, then you need to "import" the file in the main fla and then declare an instance of it and add it to the stage.

     

    import YourClass;

    var textScroll:YourClass = new YourClass();

    addChild(textScroll);

     

    Personally, I don't deal with classes that much, so for me, yes it would be easier to add the code to the fla file.  Whenever I do deal with as files I end up forgetting to save them every time I add or adjust some code, which can be troublesome when troubleshooting.  If the code is in the fla, I don't have to remember that all the time.

     

    There is a practicality consideration to weigh in deciding whether to use class files or not.... if you are only going to create a one time design with unique features, there isn't much benefit in creating classes.  Classes become meaningful when you are creating re-useable code... code that can quickly be applied to new projects the same way you might add a component or a textfield.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 22, 2009 3:19 PM   in reply to ForrestMorgan

    Please remove me from your list thanks debb4jc54@yahoo.com

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points