External text not working in dynamic text box

  • ESDesign
  • Newbie
  • Newbie
  • ESDesign
  • Posts: 6

Post 3+ Months Ago

I'm having some problems with loading an external .txt file into Flash.

First a little info; I'm using Flash CS3 and ActionScript 3.0, and I'm using a Mac.

Anyway, I've tried a variety of methods and here's what I have going currently:

I have a movie clip inside of my main movie that basically holds a page of the website.
There are 3 layers within this movie clip.

The first layer is my Actions layer, where I have the following code:
Code: [ Select ]
 
loadVariables("bio.txt");//Loads Bio page text.
 
  1.  
  2. loadVariables("bio.txt");//Loads Bio page text.
  3.  


The second layer is the Content layer, where the dynamic text box is. The dynamic text box has "contentBio" in the var field (excluding the quotation marks).

The third layer simply contains an instance of my navigation menu, and the 4th layer contains background graphics and other images.

The text file referred to in the code on the first layer contains the following text:
Code: [ Select ]
 
contentBio=Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test.
 
  1.  
  2. contentBio=Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test. Biography test.
  3.  


Whats got me scratching my head is that I've used this exact same code on a different website before, and it worked flawlessly. However the difference in my other site is that all of my variables were declared and used on the main stage, not inside a movie clip.

Therefore my first guess was that this is a path problem, so I tried adding _global. to the beginning of the code in the Actions layer, which didn't work. Could it be that the syntax is different in ActionScript 3.0 than 2.0? (since the website I used this code on before was designed in Flash MX)

I've tried manipulating the code in seemingly more ways than I can remember, which eventually led me to give up and ask the experts here, any ideas as to why this isn't working?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

You need to use the new URLLoader object.

Quote:
Flash has the ability of importing text from a simple text or XML file. In this case, we will be using the new URLLoader object in ActionScript 3.0 to dynamically load variables from an external text file.

Note: In ActionScript 2.0, it is possible to use a simple loadVariables script to capture variables from an external text file and then populate the text fields by calling on the specific variable in the Var field.
ActionScript 3.0 does not support the Var field for dynamic text fields as all scripts are written only in the timeline now, not on individual objects.


http://www.layersmagazine.com/dynamic-t ... flash.html

Follow that link and scroll down to the "Getting Dynamic" section. That should get you were you want to be.
  • ESDesign
  • Newbie
  • Newbie
  • ESDesign
  • Posts: 6

Post 3+ Months Ago

Thanks for the reply, although I'm sorry to say that I mistakingly said that I was using ActionsScript 3.0 when in fact I'm using 2.0.

The reason for this is that my co-worker designed the site's navigation using 2.0 and it appears that the site won't work if I switch the publish settings to 3.0, therefore I'm stuck using 2.0.

Since the code I used on this website is 2.0 anyway, shouldn't it work?

Am I missing something? Perhaps CS3 doesn't work well with ActionScript 2.0?

Thanks again.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Well you are right, you can't publish AS3 in an AS2 site. For AS2 what you are doing should be working. At least as best as I can tell.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 16 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.