SunQuest
           Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 29th, 2003, 11:27 AM
ianh ianh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 ianh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Dynamically display jpeg

I want to display a jpeg in a Flash movie based on a value in a MIME-format text file.

The text file is called "variables.txt", and contains the following:

inum=image1.jpg;

The following obviously works:

_root.createEmptyMovieClip("imageHolder1",200);
imageHolder1._x=0;
imageHolder1._y=100;
loadmovie("image1.jpg","ImageHolder1");

But how do I replace the hard-coded image name with the value of the variable?

Is it even possible?

Thanks.

Reply With Quote
  #2  
Old January 29th, 2003, 12:23 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
hey, you'll want to load the values from the text file. And generally when you load variables, they need to be formatted like:

&variable=value&variable2=value2...

So, if you had a text file "variables.txt" with:

&inum=image1.jpg

in your flash movie, you sould say:
PHP Code:
//it's not actually php, obviously, but i just wanted to format the code
myTextVars = new LoadVars();
myTextVars.onLoad = function(success){
 if(
success){
   
_root.createEmptyMovieClip("imageHolder1",200);
   
_root.imageHolder1._x=0;
   
_root.imageHolder1._y=100;
   
_root.imageHolder1.loadMovie(this.inum);
 } else {
   
//trace error message
 
}
}
myTextVars.load("variables.txt"); 

You could also make an array of images in your text file, but there is no way to natively load in an array, you'd have to delimit your variables by something weird and then parse in flash:

&images=image1|image2|image3|image4

in flash you could just use the split method to make a flash native array. (flashImages = images.split("|"); )

hope that helps,

bret

Reply With Quote
  #3  
Old January 30th, 2003, 04:30 AM
ianh ianh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 ianh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Bret,
Works beautifully. Thanks for taking the time to reply.
Ian

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Dynamically display jpeg


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway