hello,
I have a flash page that is being driven by an access db, I am successfully getting all the text to display in dynamic text boxes... I need to load an image as well... how do i do this, can i load a swf or jpg file into a dynamic text box.... i dont think so, but what can i do... this is my code for displaying the text, as well as the name of the image...
Code:
// depth
depth = -1;
// hide the origional clips
Name._visible = 0;
Age._visible = 0;
Image._visible = 0;
// split up the array by looking for the commas
Name_array = output.split(",");
Age_array = eoutput.split(",");
Image_array = eoutput2.split(",");
// get the length of the array
Name_length = Name_array.length;
Age_length = Age_array.length;
Image_length = Image_array.length;
// set the start y position (x position depends on where you put it on the screen)
yposition = 235;
// looping everything
for (i=0; i<Name_length; i++) {
// Name
duplicateMovieClip(Name, "Name" add i, depth);
setProperty("Name" add i, _y, yposition);
Name.Name = Name_array[1];
set("Name" add i add ".info", Name_array[i]);
depth--;
// Age
duplicateMovieClip(Age, "Age" add i, depth);
setProperty("Age" add i, _y, yposition);
Age.Age = Age_array[1];
set("Age" add i add ".info", Age_array[i]);
depth--;
// Image
duplicateMovieClip(Image, "Image" add i, depth);
setProperty("Image" add i, _y, yposition);
Image.Image = Image_array[1];
set("Image" add i add ".info", Image_array[i]);
depth--;
// Set the y position plus 30
yposition = yposition+100;
}
Heres some info on loading external files. It applies to jpg images as well ( jpg's works in MX only).
There are two ways of loading external files into Flash. Either you can load swf files into _levels or into movieclip targets.
_levels only exist in the Flash player. They are like layers but for swf files The Flash player is like a overhead projector where the plastic films you put on top of each other are like the swf files in the player. There are 16000 available levels
//To load a external swf into a _level from a button. The number 1 being the level to load into.
Movieclip targets are what it sounds like. A empty movieclip placed on the stage just for the purpose of loading a swf file into it. The advantage is that you can place it anywhere, manually ( as opposed to swf's in _levels) and also can control what othe objects shoeld be on top or beneath.
Usually you give the movieclip an instance name of container.
//To load a external swf into a target movieclip from a button ( both being on the main timeline ).
As the dynamically created mc is holding a loaded swf file it can not have anything else in it, unless the external swf itself has atextfield you can display it in. Or you can have the textbox mc have the same coordinate as the other mc so it appears to be inside it.
my sql in my asp page is grabbing 3 things
name
profile
image
So far my flash file is looping through the sql results and displaying
name as text (eg... My name)
profile as text (eg.... I am 18 feet tall, I have a blue nose)
image as text (eg.... myPicture.swf)
BUT......
I want it to display the image as an image,
So... my code now is displaying
name in a dynamic text field
profile in a dynamic text field
image in a dynamic text field... I want this to display an image instead..
The reason that i have the image in a test field at the moment, is for testing purposes
In flash kit, some of us have footers under all our posts, these images are not in the database...but the names of the images are in the database.... SO. i want my flash file to display the images dynamically, just like flash kit is displaying our footers as images, and not image names
i know my code is wrong, LOL,
thats why i am posting it here, i am trying to figure it out myself, but i really have no idea what to do.. I am trying to follow the pattern that is allready there for displaying text, I just dont know how to convert it to display a image, I did try exactly what u posted, but it didnt work either....
This is the code below, that is being used to display text in the dynamic text boxes, it also duplicates the text box for the amount of recordset returns from the db,.. that is sent to flash in the array.. Did u d/l my latest .fla file ??/ In it, you will see how it is set up.
For some reason, I dont think u understand what I am trying to do. i do not know how to explain it better....
// Age
duplicateMovieClip(Age, "Age" add i, depth);
setProperty("Age" add i, _y, yposition);
Age.Age = Age_array[1];
set("Age" add i add ".info", Age_array[i]);
depth--;
Im not into arrays, I only work with loops and dynamic variables ( which is almost the same thing).
I would suggest yo try the loadMovie thing on a separate file to get the hang of it and then implement it in your current code. To many things may go wrong as it is and its better to get a understanding to get the separate elements to work by themselves first.