Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Image Load



I am trying to code the (grey) buttons on this website so that they will load an image/text/video placeholder into the large white box, can someone please help me? Thanks (i am using flash 8)



FlashKit > Flash Help > Flash ActionScript
Posted on: 10-01-2006, 11:45 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Load Image Using LoadMovie - Can You Dynamically Change The Image Size?
Hello,

Is it possible to dynamically change the size of an image that is loaded into flash using the loadMovie function?

loadMovie("/images/tripOne/image1.jpg", "image1MC");Regards
Rob

Flash8 Image Loeader-can Load Image Which Save In Different Folder?
hi~is anyone know abt flash 8 image component able to load the image that not in the same folder? or it only can load image which save in the same folder??thankss!! urgent!~! thanks

Dynamically Load An Image-Either The Image Resizes Or The Movieclip It's Loading To?
I will make a frame movie instance 400 X 400px called frame_mv.

I will use the script:
loadMovie("pic1.jpg", frame_mv);

If the pics being loaded were of different sizes. eg pic1.jpg was 1600 X 800

1- How would I make the pic resize to 400 X 400 or 400 X 200 so that it fits the frame_mv.
2- How would I make the frame_mv change size according to the pic dimensions being loaded?

I Need To Load A Image(jpg) Into Flash With A Text File With The Url For The Image
As the name says it all.

I need to add some AS in my flash site, so that the image (banner) is dynamic, meaning when I want to make a change to it, or make it look different, i dont want to go into flash to do it. So I want it so that when I change the jpg itself it changes inside of flash.

I would like flash to look up a txt file I give it, and inside the txt file it will have a URL to which jpg to load up in the movieclip.

If not this way, another similar way would be great

Thanks!

Load Image, Remove MC, Bring Back Image
I'm using some dynamic images for a scrolling menu. The scrolling menu comes from a version that used static images. In that version, it simply ran through the objects that should be visible, attach new mc's for those that are missing and deleting the ones that are no longer visible. Now, when I bring in the dynamic images, the people will have to load the images several times everytime they go up and down.

How do I load all the images into memory and then call on them just as I would call on them if they were in the library?

[F8] Load Image, Fade-up, Load Another Image
Here's what I want to do:Load external image(s) when btn is clicked.
Have the image fade-up.
Be able to click the same btn and load another image (replacing the previous image).
Be able to do this for about 20 images.
All via AS.
Any good code to accomplish this?

Load Image From Folder Without Image Path?
I'm trying to get flash to load an image from inside a folder. The problem is that the image name as well as the format (gif/jpg/png) are unknown. Basically I want to tell it "go look inside that folder and load the image that's there". Is this possible somehow?

XML Image Gallery: Replacing Xml To Load New Image Set?
Hi Kirupa crew!

First, big thanks for this great site!

Second, I'm struggling a bit on xml and hoping for a hand. Your xml image gallery is a sweet piece of work, and I would like to be able to add the functionality of being able to load different galleries from a menu without loading a new mc with gallery inside it. I managed to botch the file up pretty good on my own, and was wondering if there is a ready answer nearby.

So I'm thinking have but1, but2 and but3, with a seperate xml file for each. What would you recommend for a smooth way to swap the the xml files to the gallery, and load the first image of the new xml file? Also, can it be done with one big ol' xml file while keeping the galleries seperate? It's not necessary, but could be handy, and save some loading.

It would also be interesting to apply the same principle to the resizing script that Scotty has in that big Resizing thread, just a thought.

Many many thanks!
John

XML Image Gallery: Replacing Xml To Load New Image Set?
Hi Kirupa crew!

First, big thanks for this great site!

Second, I'm struggling a bit on xml and hoping for a hand. Your xml image gallery is a sweet piece of work, and I would like to be able to add the functionality of being able to load different galleries from a menu without loading a new mc with gallery inside it. I managed to botch the file up pretty good on my own, and was wondering if there is a ready answer nearby.

So I'm thinking have but1, but2 and but3, with a seperate xml file for each. What would you recommend for a smooth way to swap the the xml files to the gallery, and load the first image of the new xml file? Also, can it be done with one big ol' xml file while keeping the galleries seperate? It's not necessary, but could be handy, and save some loading.

It would also be interesting to apply the same principle to the resizing script that Scotty has in that big Resizing thread, just a thought.

Many many thanks!
John

When Image Loaded Load Next Movieclip's Image?
i have a series of duplicated MCs, each with an image, i want them to load 1 image at a time, and when that is 100% loaded tell the next movieclip to load its images and so on.
And when the final MC has completed loading call an action.

after the 1st mc's image has loaded though, all the others seem to start?!

mc action,

ActionScript Code:
onClipEvent (enterFrame) {
    loaded = this.getBytesLoaded()/this.getBytesTotal()*100;
    loadedb = this.getBytesLoaded()/this.getBytesTotal()*100;
    _parent.percent = Math.floor(loaded) add "%";
    //
    //
    if (loadedb<99 and loadedb>80 or loadedb === 100 and _parent.xxx eq "go") {
        _parent._parent["icon" add _parent.k].load_image();
        _parent.xxx = "done";
        _root.lastv.scrollerz.scrollbar_mcy.reset();
    }
    if (_parent.i == fff and _parent.xxx eq "done") {
        _parent.xxx = "complete";
        _root.lastv.scrollerz.scrollbar_mcy.reset();
        if (loaded == 100) {
            trace(this+"· !ˇ! ·"+loaded);
            _root.lastv.scrollerz.scrollbar_mcy.reset();
        }
    }
}


load image action,

PHP Code:



function load_image() {
    this._visible = 1;
    ladeBild(image_main, image_path add file_name);
    per._visible = 1;
    xxx = "go";


Ok I'm Using Load Vars, But How Do I Load An Image From A Folder
I'm finally using loadVars instead of loadVariables. I'm loading a php file.

But how do I load images from a folder on my server into Flash?

thanks

Help- How To Load First Image From XML Image Gallery
Hi-
Help- I'd like to making the first image load onto movie. Attached is the code. Any hints would be awesome.

myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
//portfolioTag = this.firstChild;
numimages = this.firstChild.childNodes.length;
spacing = 70;
for (i=0; i<numimages; i++) {
picHolder = this.firstChild.childNodes[i];
thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
thumbHolder._x = i*spacing;
thumbLoader = thumbholder.createEmptyMovieClip("thumbnail_image" , 0);
thumbLoader.loadMovie(picHolder.attributes.appthmb );
thumbHolder.app = picHolder.attributes.app;
thumbHolder.appdesc = picHolder.attributes.appdesc;
thumbHolder.appmain = picHolder.attributes.appmain;
thumbHolder.onRelease = function() {
loader.loadMovie(this.appmain);
app_txt.text = this.app;
appdesc_txt.text = this.appdesc;
};
}
};
myPhoto.load("appphoto.xml");

Load Image Using The Image Name From A Database
I do query and set the image name from the database to

Image=http://blahblah.com/blah.jpg

Now I am trying to pull this into a flash movie as a variable

Any Ideas?

I get all the text and stuff to load just not the image.



Load Image, But Do (xyz) If Image Not Found
so, i'm trying to create a series of projects that all incorporate say a series of images for a sort of image gallery. Let's say through these 5 projects, there could be at most 30 images. I've set up MC's to all load the same image name, img01, img02, etc. although the folder that the images reside in will be different, so as to reduce workload. So project A loads images from p1 folder, and project B loads from p2 folder.

So, is there a way via AS to load these images, but say if there is only 15 images, the other 15 MCs loading jpgs will realize they have nothing to load and say change their alpha to 50%. I think it would have something to do with using null, but not sure. Any ideas?

How To Load URL From .txt File And Use URL To Load Image?
txtfile (imageurl.txt):
Code:
img=http://www.image.com/images/home_wedding_pic.jpg
swf:
ActionScript Code:
loadVARS = new LoadVars();loadVARS.onLoad = function(success) {    if (success) {        img_container.loadMovie(this.img);    } else {        trace("FAILED");    }};loadVARS.load("imageurl.txt");
This works when I hit ctrl+enter to test within the flash GUI, but not when I open the swf from my computer. wtf!

However, having a flash file with ONLY the following:


ActionScript Code:
img_container.loadMovie("http://www.image.com/images/home_wedding_pic.jpg");
This works in flash and even from the swf itself! Somethings fishy with the loadvars method.

Using CS3, AS2.0. Thanks!

On ( Press ) To Load An Image, But I Want It To Load Right Away.
on( press )
{
    mcImage.loadMovie( txtImageURL.text );    
}

This loads a url from a database to display an image.

How can I get the on ( press ) to press itself on eventload
or whatever.  I have tried load movies etc



Load Image
I want to display an image within a movieclip.

I am using ASP to get the data from the backend. the result that I am getting is the path of the image from the backend

How can I use this path to load the image into flash within a specific movieclip.

Can somebody guide please.

MX Load Image *Bug*
Finally you get to load Jpegs into a flash movie...
But apparently NOT if they they are progressively compressed...

Well, had big plans of a chat with the possibility of letting users send images....
But that down the drain now, can't really tell users to only load pictures without "progressive compression", which only 10% knows what is...

I am I right in this, or what?

Timster.

How Can I Load A Image From...
how can i load an image, movie or graphic from the library by clicking in a button

Load Image In A Swf
I have a little problem and maybe you can help me (I can't speak english very well)

I have an input text field
1 button

in the text field you put something
when you clic the button, it opens a browser with the url+the text in the field

but the page only contains an image, the name of the image is different from the text in the TextField

for example, you enter FLASH, clic, and if it is found, the image OK.jpg is loadead in a page, if it isn't found the image NO.jpg is loaded


and I want to know if there is a way to load the image in the SWF instead in a page

Thanks

Load Image
Hi Guys,

I have a jpg I need to load into Flash MX. The size is width 3000 and hieght 291. When I load it into a scrollable movie clip only half of the picture appears. WHY?

Thanks,
-Sweet

How To Load An Image
i want the image to fade in. i.e the image should gradually come onto the screen. i know that this can be done by the alpha option. but how to use action script for this purpose.

Load An Image
I have a movie, whose purpose is to load an image, into a movieclip, or a button, or whatever. the tricky part is, I have it so that it is a user specified image. here is my code. how do I fix it?


Code:
on(release){
urls = urlvar
}

this is the button you push to submit youre url, urls is the input text field, urlvar is a var I refer to later.

Code:
on (release,releaseOutside) {
loadMovie(urlvar, _root.imaged);
}

this is the button in which I want it to load. it is called imaged.

Load Image?
I have forgotten how to load a image inside a flash movie. i have done it once ages ago but can not remember please can someone remind me?

jay

Load Image
Hi everyone. I'm using this to load an external jpg into my Movieclip.
Why does the size change when the image is loaded into the Movieclip.
Both original image and Movieclip are the same size...

on(release) {
_root.NyMovie.loadmovie("001.jpg");
}

PLEASE HELP , pulling my hair and soon bald...

Magnus

Help With Image Load
i am loading images into a gallery site. the thumbnails are loaded with variables that correspond ( via a text document ) to images. there are two ways to get into the galleries, one straight through by clicking on them from the main page, the other by going through "enter" and then loading the galleries. when you go straight in to a gallery, my thumbnails arent loading and i get an error message in the activity window in Safari that says

http://www.headwatersdesign.com/testing/images/ forbidden

whats going on here. i can post the code thats on the thumbnails if that is relevent.

Image Load
this is what i do.

mini = _root.createEmptyMovieClip("mini",5321);
mini.loadMovie("Images/Mini.jpg");
mini._x = xpos + 220;

now I would like to create onRollOvers on this image. but the mouse Icon just stays the same, so I think he does not recognize this image as able to be affected by RollOvers. What do i need to do? can i change the mini to a button somehow

Load Image
I want to load a imagem so that every time i change it i dont have to change the swf...
Only have to maintain the size of the image(100W, 50H something like this...)

Best Regards

Rui Bárcia

Load Image
hi there! i've been trying to load an image to a flash movie using action script! i got it but when i open the file using the IE(the movie is to be used in a webpage), the image isn't loaded! i've already tryed to change the path of the image file(to the root of the website) but it doesn't work!What else can i do?

thanks!!!

Load Image
Hello

I'd like to load .jpg images. So in my movieclip, I call the jpg image
like this: mcimage1.loadMovie("pictures/1.jpg");
So far, so good.

The only thing is that, I'd like my flash to detect if that image,
called 1.jpg, does really exist.
In that case load another image, called 2.jpg; mcimage1.loadMovie("pictures/2.jpg");

Can someone help me?

Thx

Image U.LOAD
Can anyone give me a website which lets me upload unlimited images and gives me a URL for it real easy?
THANKS!
ps NO IMAGESHACK.US!!!

Image Won't Load
Hello,
I have a scroll panel with thumbnails, when a thumbnail is clicked, the corresponding video is loaded in the player, and another image should appear beside it. I made a list in xml containing the thumbnails, videos, and the images.
When i click on a thumbnail, the proper video loads but the image does not and i get this the following error:

(TypeError: Error #1034: Type Coercion failed: cannot convert "image" to flash.net.URLRequest.
at imaktion12_fla::MainTimeline/playOnClick()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at com.afcomponents.common::ItemData/setEvent()
at com.afcomponents.common::AfImage/com.afcomponents.common::dataEvent(),

Here is part of my xml code:
<content>
<item>
<description>image</description>
<path>thumbnail</path>
<data>video</data>
<type></type>
</item>


Here is my AS:

import fl.video.VideoEvent;
import flash.events.MouseEvent;
import com.afcomponents.scrollpanel.ScrollPanelEvent;

function loadComplete(event:ScrollPanelEvent){
myScroll.addGenericItemEventListener(MouseEvent.CL ICK, playOnClick);
video1.source = myScroll.getSelectedItem().data;
imageLoader.source = myScroll.getSelectedItem().description;
}
myScroll.addEventListener(ScrollPanelEvent.XML_LOA D_COMPLETE, loadComplete);

function playOnClick(event:MouseEvent) {
video1.source = event.target.data;
var imageLoader:Loader = new Loader();
imageLoader.load(event.target.description);
addChild(imageLoader);
imageLoader.y = 160;
imageLoader.x = 22;
}


function nextMovie(event:VideoEvent) {
myScroll.selectNextItem();
video1.source = myScroll.getSelectedItem().data;
}
video1.addEventListener(VideoEvent.COMPLETE, nextMovie);

thanks

Load Image
so, im trying to create an image gallery ..ive created a xml file, and the captions are working fine.. but im having trouble loading the image ..so, the code for the caption is:



Code:
caption.text = imagelist[0].caption;
so, for the image, would it be:


Code:
image.text = imagelist[0].image;
but what do i have to change the text to?



Code:
image.mc = imagelist[0].image;
mc ..movieclip? or no? cause i have no clue lol

and on the stage, id have to create a movie clip with an instance name "image", is that correct? it should then load the image, i suppose?

text, was much easier ..text tool -> dynamic text -> instance name ..but the image is again ..freakin me out lol

anyway.. any help is appreciated ..and i hope that the stuff i wrote up there is makin sense;D

[CS3] Load Image From Xml
Hi there!

I searched A LOT on the Internet about how to load an external image from a .xml file, but found only complicated things.
Sorry for asking, but

I just want to

load an image to one frame in my project.
load another image to another frame
etc (max 8 times)

I already have a .xml file that sends me a text information.
I think I have to add some lines into my .xml file for the pictures.
What lines should I add?

And also I think I need to create an actionscript for each of those frames who loads my pictures. I also think I need to create the shape where the picture need to be loaded. How? What type? What as?
I also want the picture to load into the center of this shape if this possible.

I am using Flash6 with As2

Please help a dummy

Cant Load Image
i just did a tutorial that taught me how to load an image the code was this:

Code:
package {



import flash.display.Sprite;

import flash.display.Loader;

import flash.net.URLRequest;



public class LoadImage extends Sprite {



public function LoadImage() {

var imageLoader:Loader = new Loader();

imageLoader.load(new URLRequest("ucomputer.png"));
imageLoader.x = 50;
imageLoader.y = 50;

addChild(imageLoader);

}

}

}


when i compiled that, it worked perfectly, so i made this file to see if i could do it by myself. its in the same directory

Code:
package {

import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;

public class tryit extends Sprite {

public function LoadImage() {
var comp:Loader = new Loader();
comp.load(new URLRequest("ucomputer.png"));
comp.x = 500;
comp.y = 500;
addChild(comp);
}
}
}

when i compile that, it gives me this warning

Quote:





col: 35 Warning: return value for function 'LoadImage' has no type declaration.

public function LoadImage() {
^

/home/ryland/Desktop/as3/poog.swf (675 bytes)





but it still compiles, but when i view it all i see is a blank flash page. anyone know what happened?

Load Image In Through Xml In As3?
ive always shown images from within flash, trying to streamline a quick project a bit more but no idea how i go about loading in an image, i have it set up through xml.

as text is loaded through a text box, i think (due to looking at a few search results) that xml's are done through loaders but not sure where to start with that.

does anybody have an example file of just one image that loads so i can see the basic operation, think i can handle it from there?

thanks
Dan

Xml Load Image
HI-

I have a very simple page that is presently loading external jpgs using xml. I need to be able to have several buttons on the stage that laod specific .jpg files. Most of the reference on this loads random or just the next .jpg in the list.

Can anyone point me in the right direction - here is the actionscript code i presently have on the "next" and "back button" . I would rather have 3 buttons named one thru three that load 3 specific images.

++++++

//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
}
//
// Event handler for 'Next slide' button
next_btn.onRelease = function() {
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null) {
break;
} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
};
//
// Event handler for 'Previous slide' button
back_btn.onRelease = function() {
previousSlideNode = currentSlideNode.previousSibling;
if (previousSlideNode == null) {
break;
} else {
currentIndex--;
currentSlideNode = previousSlideNode;
updateSlide(previousSlideNode);
}
};


+++++++

Load An Image
if I click on a mc or a button how can I load an image onto the stage?
Do I need to just make a pre-loaded symbol be enabled or do i need to load from file.

Load Image Via XML
I have xml code

PHP Code:



<?xml version='1.0' encoding='UTF-8'?>
<intro>
        <primary introImage='images/img01.jpg'  />
</intro>



and I want Flash to load that image. Simple, right? Not so for me. I understand that I should be using loadclip for more control but unless I reference the image directly, it won't load. Here's what i have...

PHP Code:



var container:MovieClip = introMC.introImage;
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("images/img01.jpg", container); 




Help?

Load Image
hi all
I am developing a application on Asp.net (2.0) and Flash
When i get a Image on Database after that i want give it to Flash (so dont save this image on Server Machine)
u can show exameple is :http://sit.ipi.it/pcorti/MapFlashVie...r/FlashViewer/
and Source flash is: http://www.paolocorti.net/download/M...MFV_DotNet.zip
I run this example but it not run some body show for me.
How will i do that ??

Can't Load Big Image
Hi,

I've a problem to load big image to movieclip using loadMovie or mcl, the image quite big 4000px width. This my code :


PHP Code:



var image:MovieClip = containerbg.createEmptyMovieClip("image", containerbg.getNextHighestDepth());

MCL = new MovieClipLoader();
MCL.loadClip("bkgd/"+file.name, image);
MCL.onLoadComplete = function () {
    containerbg._width = containerbg._width / 4;
    containerbg._height = containerbg._height / 4;
}; 




anyone can help me?

Thanks b4

Load Image
so, im trying to create an image gallery ..ive created a xml file, and the captions are working fine.. but im having trouble loading the image ..so, the code for the caption is:


Code:
caption.text = imagelist[0].caption;
so, for the image, would it be:


Code:
image.text = imagelist[0].image;
but what do i have to change the text to?


Code:
image.mc = imagelist[0].image;
mc ..movieclip? or no? cause i have no clue lol

and on the stage, id have to create a movie clip with an instance name "image", is that correct? it should then load the image, i suppose?

text, was much easier ..text tool -> dynamic text -> instance name ..but the image is again ..freakin me out lol

anyway.. any help is appreciated ..and i hope that the stuff i wrote up there is makin sense;D

Cannot Load Image
Hello,

I'm trying to load an image. Nothing is displayed. Here is my code:

Code:
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;

public class Main extends Sprite
{
private var logoLoader:Loader;
private var logoup:URLRequest;

public function Main():void
{
logoLoader = new Loader();
logoup = new URLRequest("img.jpg");

logoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
logoLoader.load(logoup);
}

public function onComplete(evt:Event):void
{
addChild(logoLoader.content);
logoLoader.x = 40;
logoLoader.y = 20;
}
}
}
I'm basing this code from a tutorial.

Load Image
I created the simpliest exmple of upload file, all is ok, but event.bytesLoaded sent wrong information aout loaded data. But i want to see real received data.


// imported classes
import fl.controls.DataGrid;
import fl.controls.ProgressBarMode;
import flash.net.FileReference;
import flash.net.URLRequest;

// imported classes

// vars
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
var allTypes:Array = new Array(imageTypes);
var fr:FileReference = new FileReference();
pb.mode = ProgressBarMode.MANUAL;

// vars



//events of buttons
butt.addEventListener(MouseEvent.CLICK, browseFiles);
fr.addEventListener(Event.SELECT, selectHandler);
//events of buttons



function browseFiles(event:MouseEvent):void {
fr.browse(allTypes); // browse files
}

function selectHandler(event:Event):void {

nameFile.text=fr.name;
var request:URLRequest = new URLRequest("upload.php");
fr.addEventListener(Event.OPEN, openHandler);
fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
fr.addEventListener(Event.COMPLETE, completeHandler);
fr.upload(request);

}

function openHandler(event:Event):void
{
status.text='start';
}

function completeHandler(event:Event):void
{
status.text='complete';
}

function progressHandler(event:ProgressEvent):void
{
loaded.text=Math.round(event.bytesLoaded/event.bytesTotal*100)+ " % Loaded" // sent wrong data!!!
pb.setProgress(event.bytesLoaded, event.bytesTotal);
}

// server side

<?php

move_uploaded_file($_FILES['Filedata']['tmp_name'], $_FILES['Filedata']['name']);

?>

Live Example

Load Image
I created the simpliest exmple of upload file, all is ok, but event.bytesLoaded sent wrong information aout loaded data. But i want to see real received data.


// imported classes
import fl.controls.DataGrid;
import fl.controls.ProgressBarMode;
import flash.net.FileReference;
import flash.net.URLRequest;

// imported classes

// vars
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
var allTypes:Array = new Array(imageTypes);
var fr:FileReference = new FileReference();
pb.mode = ProgressBarMode.MANUAL;

// vars



//events of buttons
butt.addEventListener(MouseEvent.CLICK, browseFiles);
fr.addEventListener(Event.SELECT, selectHandler);
//events of buttons



function browseFiles(event:MouseEvent):void {
fr.browse(allTypes); // browse files
}

function selectHandler(event:Event):void {

nameFile.text=fr.name;
var request:URLRequest = new URLRequest("upload.php");
fr.addEventListener(Event.OPEN, openHandler);
fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
fr.addEventListener(Event.COMPLETE, completeHandler);
fr.upload(request);

}

function openHandler(event:Event):void
{
status.text='start';
}

function completeHandler(event:Event):void
{
status.text='complete';
}

function progressHandler(event:ProgressEvent):void
{
loaded.text=Math.round(event.bytesLoaded/event.bytesTotal*100)+ " % Loaded" // sent wrong data!!!
pb.setProgress(event.bytesLoaded, event.bytesTotal);
}

// server side

<?php

move_uploaded_file($_FILES['Filedata']['tmp_name'], $_FILES['Filedata']['name']);

?>

Live Example

Can't Load Image
Hello,
I have a scroll panel with thumbnails, when a thumbnail is clicked, the corresponding video is loaded in the player, and another image should appear beside it. I made a list in xml containing the thumbnails, videos, and the images.
When i click on a thumbnail, the proper video loads but the image does not and i get this the following error:

(TypeError: Error #1034: Type Coercion failed: cannot convert "image" to flash.net.URLRequest.
at imaktion12_fla::MainTimeline/playOnClick()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.afcomponents.common::ItemData/setEvent()
at com.afcomponents.common::AfImage/com.afcomponents.common::dataEvent(),

Here is part of my xml code:
<content>
<item>
<description>image</description>
<path>thumbnail</path>
<data>video</data>
<type></type>
</item>


Here is my AS:

import fl.video.VideoEvent;
import flash.events.MouseEvent;
import com.afcomponents.scrollpanel.ScrollPanelEvent;

function loadComplete(event:ScrollPanelEvent){
myScroll.addGenericItemEventListener(MouseEvent.CLICK, playOnClick);
video1.source = myScroll.getSelectedItem().data;
imageLoader.source = myScroll.getSelectedItem().description;
}
myScroll.addEventListener(ScrollPanelEvent.XML_LOAD_COMPLETE, loadComplete);

function playOnClick(event:MouseEvent) {
video1.source = event.target.data;
var imageLoader:Loader = new Loader();
imageLoader.load(event.target.description);
addChild(imageLoader);
imageLoader.y = 160;
imageLoader.x = 22;
}


function nextMovie(event:VideoEvent) {
myScroll.selectNextItem();
video1.source = myScroll.getSelectedItem().data;
}
video1.addEventListener(VideoEvent.COMPLETE, nextMovie);

thanks

Image Won't Load From XML
I am making a gallery using xml and as3. I've run into a problem very early and I'm not too good with Actionscript yet. So I've come here for some help.

What I want right now, is to have an image be loaded from a xml file, which is working for me. And then have a white movieclip come in a resize behind the image to be a frame for the image. I haven't gotten to this part yet. My problem starts when I try to load the image with a blank movieclip to position it. The image loads, but the eventListener won't run the imageLoaded function. If I remove the function and just have holder_mc.addchild(imageLoader); Then it works, but I need the image to load and then resize the movieclip frame, and then display both right? How can I accomplish this?







Attach Code

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loaded);

loader.load(new URLRequest("images.xml"));

var xml:XML;

var imagePath:String;
var imageLoader:Loader = new Loader();

imageLoader.addEventListener(Event.COMPLETE, imageLoaded);

function loaded(e:Event):void {
trace("xml loaded");
xml = new XML(e.target.data);
var il:XMLList = xml.images.image;
imagePath = il[1].attribute("path");
trace(imagePath);

imageLoader.load(new URLRequest(imagePath));
}

function imageLoaded(e:Event):void {
trace("imageLoaded");
holder_mc.addChild(imageLoader);
}

Copyright © 2005-08 www.BigResource.com, All rights reserved