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




LoadBytes & Event.COMPLETE



So I am loading movies that already exist in a byteArray. The data loads right away, but the Event.COMPLETE handler isn't fired for quite some time. Anyone know why? Here is my code:



Code:
var request:URLRequest = new URLRequest("image.swf")
var urlloader:URLLoader = new URLLoader();
urlloader.dataFormat = URLLoaderDataFormat.BINARY;
urlloader.addEventListener(Event.COMPLETE, dataLoaded);
urlloader.load(request);

function dataLoaded(event:Event):void {
var urlloader:URLLoader = event.currentTarget as URLLoader;
var d:byteArray = urlloader.data;

myAnimation.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
myAnimation.loadBytes(d);
}

function imageLoaded(event:Event):void {
trace("done!");
}



FlashKit > Flash Help > Actionscript 3.0
Posted on: 02-29-2008, 11:08 PM


View Complete Forum Thread with Replies

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

MovieClipLoader OnLoadInit Event AND Loader Component Complete Event
Whatīs the difference beetwen the Loader complete event and MovieClipLoader onLoadInit. The manual says onLoadInit is called after the code on the first frame of the loaded clip gets executed, so, itīs better to use onLoadInit if you want to manipulate the loaded asset via code.

So, if anyone could clarify the following points to me, I would be grateful!

- Does the complete event of the Loader component have the same behaviour?
- How does MovieClipLoader knows that the code on the first frame of the loaded assets got executed?

Thanks,

Marcelo.

Event.COMPLETE Or Event.INIT
I'm working with the loader class. I have a SWF that's loading a presentation in another SWF. The loader swf has a progress bar and perecentage text field. I want the presentation to start playing ONLY when it's 100% loaded. As of now, it starts playing at 10 - 11%.

Here's the code:

ActionScript Code:
var swf:String = "ips_test.swf";
var myURL:URLRequest = new URLRequest(swf);
var loader:Loader = new Loader();

loader.contentLoaderInfo.addEventListener(Event.OPEN, initialize);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, inProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completed);
loader.contentLoaderInfo.addEventListener(Event.INIT, initListener);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
loader.load(myURL);

function initialize(event:Event):void {
   preloader_mc.visible = true;
}
function inProgress(e:ProgressEvent):void {
   var percentage:uint = (e.bytesLoaded/e.bytesTotal)*100;
   preloader_mc.loader_txt.text = percentage.toString() + "%";
   preloader_mc.pbar.scaleX = percentage/100;
}
function completed(event:Event):void {
   if(loader.contentLoaderInfo.bytesLoaded == loader.contentLoaderInfo.bytesTotal) {
     removeEventListener(Event.OPEN, initialize);
     removeEventListener(ProgressEvent.PROGRESS, inProgress);
     addChild(loader);
   }
   preloader_mc.visible = false;
}
function initListener(e:Event):void {
   MovieClip(loader.content).play();
}
function ioErrorListener(e:IOErrorEvent):void {
   preloader_mc.loader_txt.text = "ERROR";
}

Should I start playing the content of the loader on the INIT or COMPLETE function?

EDIT
Please put code in [ as ] [ /as ] tags (without spaces)

Event.COMPLETE Vs Event.INIT
Hi you all!

In the adobe manuals, and also in the Mook book, they write that the loaderInfo INIT event occurs always before the COMPLETE event.

My question: so, is that true that ALL properties that are accessible on Event.INIT are also accessible on Event.COMPLETE?

If true, shouldn't I always use Event.COMPLETE instead of INIT?

Thank you!

Complete The Event
good day mates

I have flash movie contains 4 scene, each one contains 100 frames
and I have links (buttons) for each one ...
if i click on any buttons it's directly move to the required scene
my question is ( how can i click any button then it complete until the end of the last frame then moves me to the required scene) ?

Complete Event Won't Run?
Not sure why but I cannot get this COMPLETE event to run? For such a simple thing it sure is frustrating.

Anyone see where I've gone wrong?


ActionScript Code:
/* Load the tree */
var myLoader:Loader = new Loader();
var myTree:DisplayObject = addChild(myLoader);
var url:URLRequest = new URLRequest("Tree.swf");

myLoader.addEventListener(Event.COMPLETE, loadedSWF);
myLoader.load(url);

/*myTree.name = "Tree";
myTree.x = 450;
myTree.y = 300;*/

function loadedSWF(e:Event):void
{
    trace("why does this not run???");
   
    myTree.name = "Tree";
    myTree.x = 450;
    myTree.y = 300;
}

Complete Event For As 3.0
lets say i want to animate something based on the completion of another animation. How do I do that?

Complete Event
Hi.

I am struggling a little with calling a function on the COMPLETE event. Here is the code:


Code:
var myLoader:Loader=new Loader()

var strURL:String=<image url>
myLoader.load(new URLRequest(strURL));
myLoader.addEventListener(Event.COMPLETE, myFunction);

this.addChild(myLoader)
myLoader.x=0
myLoader.y=0

function myFunction(evt:Event){
trace("Load");
}
The image appears on the stage when loaded, but the function myFunction is not called. If anybody could help me with this, I would be very thankful

Complete Event For As 3.0
lets say i want to animate something based on the completion of another animation. How do I do that?

ProgressBar Complete Event
I have a page calling some stuff from a db and then loading in an image. I create a loader component then a progressbar component. I then add a listener to the progressbar and on load it finds the dimensions of the image loaded in. This works fine and places extra text bellow the image. the second time this happens the complete action of the progress bar seems to be called immediately well before the image is loaded resulting in a height of zero. There is an example here
http://www.ifyoucanimagine.com/Site.html

is there something I am missing is there a way to reset the loader and the progressbar to ensure it does not falsely report complete. I am removing the progressbar object on complete. here is the code.
this.createClassObject(mx.controls.Loader, "MediaLoader", this.getNextHighestDepth(),{_x:0,_y:25});
this.createClassObject(mx.controls.ProgressBar, "MediaProgress", this.getNextHighestDepth(),{_x:0,_y:25});
this.MediaProgress.setProgress(0,100)
this.MediaProgress.setSize(300,30)
this.MediaProgress.mode = "polled"
var LoadListener:Object = new Object();
LoadListener.complete = function(eventObj){
eventObj.target.removeMovieClip()
onCompleteFunction()
eventObj.target.destroyObject()
eventObj.target._parent.MediaLoader.destroyObject( )
}
this.MediaProgress.addEventListener("complete", LoadListener);
this.MediaProgress.source = this.MediaLoader
this.MediaLoader.scaleContent = false
this.MediaLoader.autoLoad = false
this.MediaLoader.contentPath = MediaLocation
this.MediaLoader.load()

AttachMovie On Complete Event?
Hi, I'm using attachMovie to call an MC to the stage, the MC contains code.

I need to make sure the MC's code was fully executed, is there a way to find this out?

I don't want to use flags in the code, I am looking for a way to do this without editing each attached MC.

Thanks in advance,
LeoBeer.

Event.COMPLETE Not Occurring
So I was trying to recreate a problem another forum member was having and ran into a weird problem of my own.

Clicking on the red sprite starts off a loader of a local URL. The problem is that the listener for Event.COMPLETE is never called. Am I on drugs or is there something very wrong here?

The following is the complete .as file. There is nothing in the .fla.


ActionScript Code:
package
{
    import flash.events.*;
    import flash.display.*;
    import flash.net.*;

    public class Junk1 extends MovieClip
    {
        var myLoader:Loader;
        var sprite:Sprite;
       
        public function Junk1():void
        {
            myLoader = new Loader();

            sprite = new Sprite();
            sprite.x = 300;
            sprite.y = 100;
            sprite.graphics.beginFill(0xFF0000);
            sprite.graphics.drawRect(0,0,50,20);
            sprite.graphics.endFill();
            sprite.addEventListener(MouseEvent.CLICK, clickBtn);
//      addChild(myLoader);
            addChild(sprite);
        }

        public function clickBtn(e:MouseEvent):void
        {
            myLoader.load( new URLRequest("cartoon_sun.png") );
            myLoader.addEventListener(Event.COMPLETE, complete);
            trace("clickBtn");
        }
       
        public function complete(e:Event):void
        {
            trace("complete");
            // I had code here before to put the image on the stage, but removed it for simplification
            // The above trace() is never called.
        }
    }
}

Event.COMPLETE Not Consistent
Here's what I am doing. I am loading external jpg with XML file one by one. this is just one part of script where I am having problem.


ActionScript Code:
var trekker:int = 0;

function loadThumb(event:Event) {

    if (trekker<imgURLlenght) {

                trekker++;
        var imageLoader:Loader = new Loader();
       
        var pictureURL:URLRequest = new URLRequest("images/thumbnails/"+imgURLArr[trekker-1]);
        imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
        imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoadingThumb );


        imageLoader.load(pictureURL);
        this.addChild(imageLoader);


        trace(trekker)// this traces fine 1,2,3,4,5,6,...20
   
    }
function doneLoadingThumb(event:Event) {

          trace(trekker) //here is the problem traces 2,4,4,5,7,7,9,9,11,11,12,12,......20,20,20
   
            imageLoader.x = (trekker-1)* (imageLoader.width+15);
        }
    }

Now when I trace the trekker in loadThumb function it traces fine like 1,2,3,4.......20
but when I trace it in doneLoadingThumb function it is inconsistence and repeat and skip some numbers and threw away all the thumb alignment.

Any body have any idea why is it doing like this.

TotalBytes And Event.Complete
Hi everyone,
I've just about had it with this problem I've been working on.

Currently I have the following setup :

1) Main Movie gets Preloaded
2) Main Movie Loads
3) Button on Main Movie Loads an external SWF
4) External SWF gets Preloaded
5) External SWF gets Displayed.

Normally, no problem at all, right ?

However, it seems like something is fiddling with the headers, and all of my swfs are returning totalBytes of 0. Not all the time mind you, but just for people who are behind corporate networks ( After a bit of research, it seems like it has something to do with gzip ).

So I've been trying to code a work around that instead of doing a bytesLoaded/bytesTotal percentage, uses Event.COMPLETE.

However I'm having another problem here. Essentially without boring you, if I attempt to load a file that is already 100% loaded. Will Event.COMPLETE be triggered ?

Any light ANYONE can shed on this subject, would be very very much appreciated.

Event Complete Question
hi
i know this is a n00b question

im making a website in as3

i want a movieclip to appear on stage after a certain function has been completed(clicking on a box, and it becomes larger to fill the stage) i want a another movie clip to appear inside this box after the box has fully scaled

thanks in advance

tried googling event handling and what not but cant seem to do it

thanks much appreciated

Why Some FLV Don't Fire Complete Event?
Hi,

I created a simple player for videos, it works fine aside from some FLV which don't fire the complete event.
I am using Flash 8 and the FLVPlayback component.

Any suggestion?

Cheers

Complete _mc Before OnRollOver Event
I've been working on an AS2 project to create smooth animated roll over buttons. The key design concept for this swf is to make sure that all of the animations run to the end even if there is a new mouse event.

So far everything is working just fine as long as you don't roll over the button that initiated the _mc before the animation completes. I've tried a bunch of if (grn_btn.onRollOver = true and grn_mc is still playaing){don'tPlay.grn_mc again until it ends } statements but can't find anything that works.

(* code written in english so you can figure out what I'm trying to do)

Attached is the working code so far. I'd appreciate any guidance.







Attach Code

/*
buttons controlling movie clips
movies complete if early roll out occurs
*/

// button definitions
grn_btn.onRollOver = over_grn;
grn_btn.onRollOut = out_grn;

blu_btn.onRollOver = over_blu;
blu_btn.onRollOut = out_blu;

red_btn.onRollOver = over_red;
red_btn.onRollOut = out_red;

// onRollOver functions
function over_grn () {
grn_mc.overThis = true;
grn_mc.gotoAndPlay("start");
}

function over_blu () {
blu_mc.overThis = true;
blu_mc.gotoAndPlay("start");
}

function over_red () {
red_mc.overThis = true;
red_mc.gotoAndPlay("start");
}

// onRollOut functions
function out_grn () {
grn_mc.overThis = false;
}

function out_blu () {
blu_mc.overThis = false;
}

function out_red () {
red_mc.overThis = false;
}

//end roll over code

This code is on each movie clip:

Actions : Frame 1 (stop);
Actions : Frame 2 if(overThis == false){
gotoAndPlay("start");
}

// removing the frame 2 script seems to make no difference
// but it was recommended
Actions : Frame 15 if(overThis == true){
gotoAndPlay("loop")
}

Labels on each movie clip:

Labels: Frame 2 start
Labels; Frame 8 loop

























Edited: 05/16/2007 at 10:52:34 AM by Rick Gerard

Dispatch Event (COMPLETE)
Hello All,

I created a class that takes in a Sprite as a Param and fades it in or out. When that Sprite is faded out completely (alpha = 0) or faded in to alpha = 1, I stop the animation. When that's done, I want to be able to call a function defined on the same key frame where the class was instantiated.

Any help is greatly appreciated.

Thank you in advanced,

V










Attach Code

// Here's my class for the fading method:

package{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.*;


public class FadeClip extends Sprite{
private var _tmFadeTimer:Timer;
private var _nmTimerSpeed:Number = 10;
private var _mcClipToFade:Sprite = new Sprite();
private var _nmEaseSpeed:Number = .02;
private var _stFadeType:String = "in";
private var _nmCurrentAlpha:Number;
private var _targetAlpha:Number = 0;

public function FadeClip(){

}

public function setClipToFade(mc:Sprite):void{
try{
_mcClipToFade = mc;
_nmCurrentAlpha = mc.alpha;
}
catch(errorObject:Error){
trace(errorObject.message);
}
}

public function getClipToFade():Sprite{
return _mcClipToFade;
}

public function setFadeType(st:String){
try{
if(st == "in"){
_targetAlpha = 1;
_stFadeType = "in"
}else if(st == "out"){
_targetAlpha = 0;
_stFadeType = "out"
}else{
throw new Error("setFadeType expected String equal to 'in' or 'out' as in fade in or fade out -- " + st);
}
}
catch(errorObject:Error){
trace(errorObject.message);
}
}

public function getFadeType():String{
return _stFadeType;
}

public function setEaseSpeed(es:Number):void{
try{
if(isNaN(es)){
throw new Error("setEaseSpeed Expected a Number.");
}else{
_nmEaseSpeed = es;
}
}
catch(errorObject:Error){
trace(errorObject.message);
}
}

public function getEaseSpeed():Number{
return _nmEaseSpeed;
}

/**/
public function setTimerSpeed(ts:Number):void{
try{
if(isNaN(ts)){
throw new Error("setTimerSpeed Expected a Number.");
}else{
_nmTimerSpeed = ts;
}
}
catch(errorObject:Error){
trace(errorObject.message);
}
}

public function getTimerSpeed():Number{
return _nmTimerSpeed;
}

public function fadeTheClip(){
_tmFadeTimer = new Timer(_nmTimerSpeed)
if(_mcClipToFade != null){
_tmFadeTimer.addEventListener(TimerEvent.TIMER, fadeInTimer);
_tmFadeTimer.start();
}else{
try{
throw new Error("Nothing to fade. Please provide a Sprite or subclass of Sprite");
}
catch(errorObject:Error){
trace(errorObject.message);
}
}
}

private function fadeInTimer(event:TimerEvent):void{
_mcClipToFade.alpha += (_targetAlpha - _mcClipToFade.alpha) * _nmEaseSpeed;
trace("_mcClipToFade.alpha " + _mcClipToFade.alpha)
if(_mcClipToFade.alpha == _targetAlpha){
var evCompleteEvent:Event = new Event("COMPLETE", true, false);
_tmFadeTimer.stop();
trace("THIS " + this);
this.dispatchEvent(evCompleteEvent);
trace("FADE COMPLETED FROM CLASS" + evCompleteEvent);/* I SEE THIS IN MY OUTPUT SCREEN. I DON'T KNOW IF THIS IS THE RIGHT APPROACH */
}
}
}
}


/*****************************************/


// And here is what I have on my main timeline:

import FadeClip;

var fc:FadeClip = new FadeClip();

fc.setClipToFade(boxMc);
fc.setFadeType("out")
fc.setEaseSpeed(.02);
fc.setTimerSpeed(30);
fc.fadeTheClip();


fc.addEventListener(Event.COMPLETE, fadeClipComplete);/* WHEN FADING IS COMPLETE, I EXPECTED IT TO BE HANDLED HERE. */

function fadeClipComplete(){
trace("FADE CLIP COMPLETE FROM ROOT");
}

























Edited: 06/01/2007 at 10:52:12 AM by vDiaz761

LoaderInfo.Event.COMPLETE
i am using Document class to setup my preloader like code below

but the event (Event.COMPLETE) not fire every time,
and i found that it only happen on IE Flash Player(ActiveX control) when IE have cache on the swf.
is that a bug?







Attach Code

function myBaseClass(){
this.stop();
this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfo_on_complete);
}

private function loaderInfo_on_complete(event:Event):void{
this.nextFrame();
}

Event.COMPLETE Not Firing On A Mac
Ran into a strange bug:

I am using the FileReference class in an uploader I created for a CMS. Everything works wonderfully except for one thing: the Event.COMPLETE event is not firing at the end of the upload in Firefox and Safari on a Mac. It works perfectly in all Windows browsers I test (FF, IE7, and Opera), and curiously, it works on another server I have it on in both Mac and PC.

Does anyone have ANY idea why this might be? I know that I can hack it a bit and have the script check for bytesLoaded vs bytesTotal, as a kind of pseudo-event-complete trigger, but I would prefer not to. Thanks to anyone with any info!

Event.COMPLETE Not Firing
Hey all,

I have a simple image loader trying to load an image with an Event Listener.

The COMPLETE event never fires however.

If I use Event.ENTER_FRAME, for example, the image loads in there just fine (but is done so hundreds of times, of course).


Code:

...


private var imageLoader:Loader;
var request:URLRequest;

private function loadImage() {
request = new URLRequest(itemData[itemId][3]);
imageLoader = new Loader();
imageLoader.addEventListener(Event.COMPLETE, imageComplete);
imageLoader.load(request);
}
public function imageComplete(event:Event) {
addChild(imageLoader);
}

...

public const any_help_appreciated:Boolean = true;

AS2 - [AS2] ScrollPane.complete Event
This is the first project that I've ever used the ScrollPane component on and it seems to be giving me a bit of troubles.

I finally got the createClassObject to work after extending UIObject. So I think I'm good there for now. However, I can't seem to get the ScrollPane.complete event to trigger when I load in my content. I'm loading in a library item that is set to "export." Do exported library items not trigger the ScrollPane.complete event? I guess it might not make much difference since it isn't technically loading, but I want to make sure that it is available before calling its class methods and begin loading XML into it. I've run into some components and things that have a delay before the are available, generally one frame etc.

The library item that I am loading into the ScrollPane is an RSS Reader. Once loaded into the ScrollPane I want to call the method to start loading the RSS Feed. Here is the code that I have so far for loading the ScrollPane.


ActionScript Code:
import mx.core.UIObject
import mx.containers.ScrollPane;
 
class CsRssWindow extends UIObject
{
   
    var CsRssScrollPane:ScrollPane;
   
    public function CsRssWindow()
    {
       
        this.createClassObject(ScrollPane,'CsRssScrollPane');
        CsRssScrollPane.setSize(280,148);
       
        CsRssScrollPane.contentPath = "CsRssContent";
       
        var CsRssPaneListener:Object = new Object();
       
        CsRssPaneListener.complete = function (eventObject:Object)
        {
           
            trace("hello");
           
        }
       
        CsRssScrollPane.addEventListener("complete", CsRssPaneListener);
       
    }
   
}


This class is linked to my RSS reader "window" library item, which then calls the scroll pane and my RSS Content item which handles all of the loading and display of the content. CsRssContent is loading in however I'm not triggering the complete event and it never traces "hello."

So I guess the two questions are:
Why isn't ScrollPane.complete firing

Do I really have to worry about this since I am just calling an exported library item?

Is there a delay in the time it take the scrollPane contents to become available? How should I handle the delay?


Any help, suggestions or insight would be greatly appreciated.

-mt

Loader/JPGs/complete Event
I'm running into a problem with the Loader component. I'm loading JPG's. I have code that is supposed to adjust the _x value of the loader so that the image is centered in the frame. It works fine sometimes, but most of the time it seems to be picking up the _width value before the image is loaded. I have the detection happening on the "complete" event of the loader, so I would assume the jpg is loaded. Do I need to add a delay or something?

Here is the link to the problem:

http://www.axis3architecture.net/fla...crollpane.html

Click "Projects", then "Photos". Some of the photos are thinner than the frame, so it should center them in the frame. However, it seems if they don't load instantly, it causes the problem.

Loader Event.COMPLETE Question
Hello,
I am working on integrating a form into a swf file using AS3. At what point does the COMPLETE event get triggered for the URLLoader?

Does it get triggered as soon as the data from the form fields get successfully sent to the server? Can it be said with 100% certainty that if the URLLoader COMPLETE event gets triggered that the data has been sent to the server?

The problem is that the server I send the info to sends back a response... but because it is on a different domain I cant listen to that response since I cant create a cross domain file and place it on the other server.

Here is my script:


Code:
request.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, gotothankyou);
// Send the form
loader.load( request );


Thanks,
mperla

NavigateToURL Get A COMPLETE Event And Redirect
Hi folks,

All I want to do is send variables to my backend, find out if that event happened successfully, and then redirect the user after the event. I see sendToURL ignores the response so you must use navigateToURL. and send vars as the DATA property of URLRequest class. But in that case how can I listen for the complete event to then redirect. I followed the examples and they are always processes as GETS not POSTS!!! This code generates errors and only seems to work if i take out "_self" but i need to redirect in the same window.


Code:
function doPurchase(event:MouseEvent){
var request:URLRequest = new URLRequest("http://widget-test.edmunds.com/mygaragewidget/restlet/account/"+user_id+"/addTransaction");
var variables:URLVariables = new URLVariables();
variables.accountId = send_user_id
variables.productId = prePurchase_arr
variables.fb_sig_session_key = fb_sig_session_key
variables.comment = comments_txt.text
request.data = variables;
var myLoader:URLLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, handleComplete);
request.method = URLRequestMethod.POST;
myLoader.load(request)
}
handleComplete = function (event:Event):void{
var myRequest:URLRequest = new URLRequest("http://apps.facebook.com/mygaragewidget/display.action");
try {
navigateToURL(myRequest, "_self");
}
catch (e:Error) {
trace ("something wrong happend in I/O")
}
}
Thanks for any insight

Loader COMPLETE Event Issue
Hey guys, I'm a newbie to as3 but I picked it up really quickly and I'm really starting to enjoy it. I have a problem right now that is really leaving me scratching my head and I am looking for help. The issue is that the Event.COMPLETE Event is not firing for my loader object and it is consequently causing my program to fail. Below is the function that creates buttons given a global XML feed.

function createButtons(e:Event):void
{
var feed:XML = new XML(loader.data); //create a storage bin for the loaded xml data

var total:int = feed..button.length();//set up grid constants
var padding:int= 150;
var startX:int= 75;
var startY:int= 75;
var cols:int= 4;
var curX:int= startX;
var curY:int= startY;

for(var i:int=0; i<total; i++)//loop through feed and add buttons
{
var button:bubble_btn= new bubble_btn();//setup button
button.x= curX;
button.y= curY;
button.buttonMode = true;
button.textzone.text= feed..cap[i].text();
button.textzone.visible= false;

var inject:Loader= new Loader();//begin xml injection
button.pic.alpha= 0;
inject.addEventListener(Event.COMPLETE, endPreload);
button.pic.addChild(inject);

inject.load(new URLRequest(feed..pic[i].text()));

addChild(button);

if((i+1)%cols==0) //fix position
{
curX = startX;
curY += padding;
}
else curX += padding;
}
}

I'm sure that the feed works so I don't think the problem is xml based. the "feed..pic[i].text()" is the path of an image that I'm also sure exists. Its just a matter of getting the "inject" loader to fire. Thanks in advance, I hope this is just a trivial thing.

URLLoader Event.COMPLETE Never Getting Dispached
Hi

I'm developing a Facebook application using AS3, PHP and FBML. I has a simple drawing application in flash, and when the user is done it is suposed to upload the picture as JPG to the server. To accomplish this I use Adobe Corelib JPGEncoder.as and a URLLoader function.

When tested on my test server it was working great. But whe I upload my files to my free Joyent Accelerator server for Facebook Developers, the Event.COMPLETE of my URLLoader is never dispached, even the JPG file is successfully upload to the server.

Do you think this is server isue or something in my code?

Joyent Accelerator servers runs under Solaris

Here is part of my code




Code:
public function done() {
variables.sendresponse = "Saving draw";
this.msgBox.text = variables.sendresponse;

var myBitmapData:BitmapData = new BitmapData(canvas.width, canvas.height);
myBitmapData.draw(canvas);
var jpgEncoder:JPGEncoder = new JPGEncoder(30);
var jpgStream:ByteArray = jpgEncoder.encode(myBitmapData);
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest;
if (facebook_userID != "") {
jpgURLRequest = new URLRequest("jpg_encoder_download.php?name=" + facebook_userID + "-" + (new Date()).getTime() + ".jpg");
} else {
jpgURLRequest = new URLRequest("jpg_encoder_download.php?name=" + (new Date()).getTime() + ".jpg");
}
jpgURLRequest.requestHeaders.push(header);
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;

var jpgURLLoader:URLLoader = new URLLoader();
jpgURLLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
jpgURLLoader.addEventListener( Event.COMPLETE, sendComplete );
jpgURLLoader.addEventListener( IOErrorEvent.IO_ERROR, sendIOError );
jpgURLLoader.load( jpgURLRequest );

}

private function sendComplete( event:Event ):void {
this.msgBox.text = "Image send";
var tmr:Timer = new Timer( 5000, 1 );
tmr.addEventListener( TimerEvent.TIMER, clearMessage );
tmr.start();
}

PHP Code:



<?php
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
    $im = $GLOBALS["HTTP_RAW_POST_DATA"];
    filename=".$_GET['name']);
    if (isset ($_GET["fbuid"])) {
        $filename = "drawings/".$_GET["fbuid"].$user.$_GET['name'];
    } else $filename = "drawings/".$_GET['name'];
    touch($filename);
    chmod($filename,0777);
    $fp = fopen($filename,"wb");
    fwrite($fp,$im);
    fclose($fp);
    
}  else echo 'Nothing happend.';
?>

QueueLoader 3.0.31 Event.COMPLETE Not Working
Has anyone used QueueLoader???

for the life of me i can't get event complete to fire when loading jpgs

NFI why... i looked at the code and the event is being configured... it just won't fire after the first image has loaded.

if anyone has come accorss this please help


PHP Code:



private function loadImages():void {
            var i:int;
            
            //Instantiate the QueueLoader
            var _oLoader:QueueLoader = new QueueLoader();
            
            //Run a loop that loads 3 images from the flashassets/images/slideshow folder
            var spriteArray:Array = new Array();
            for(i = 0; i < 10; i++) {
                spriteArray[i] = new Sprite();
                addChild(spriteArray[i]);
                spriteArray[i].x = i*10;
                //Add a load item to the loader
                _oLoader.addItem("images/image"+i+".jpg", spriteArray[i], {title:String(i)});
                
            }

            //Add event listeners to the loader
            _oLoader.addEventListener(QueueLoaderEvent.QUEUE_START, onQueueStart, false, 0, true);
            _oLoader.addEventListener(QueueLoaderEvent.ITEM_START, onItemStart, false, 0, true);
            _oLoader.addEventListener(QueueLoaderEvent.ITEM_PROGRESS, onItemProgress, false, 0, true);
            _oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
            _oLoader.addEventListener(QueueLoaderEvent.ITEM_ERROR, onItemError,false, 0, true);
            _oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
            _oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
            
            //Run the loader
            _oLoader.execute();
                    
        }
        
        private function nextImage(e:TimerEvent):void{
        
        }
        //Listener functions
        private function onQueueStart(event:QueueLoaderEvent):void {
            trace(">> "+event.type);
        }
                            
        private function onItemStart(event:QueueLoaderEvent):void {
            trace(" >> "+event.type, "item title: "+event.title);
        }
                            
        private function onItemProgress(event:QueueLoaderEvent):void {
            trace(" >> "+event.type+": "+[" percentage: "+event.percentage]);
        }
                            
        private function onQueueProgress(event:QueueLoaderEvent):void {
            trace(" >> "+event.type+": "+[" queuepercentage: "+event.queuepercentage]);
        }
                            
        private function onItemComplete(event:QueueLoaderEvent):void {
            trace(" >> name: "+event.type + " event:" + event.type+" - "+["target: "+event.targ, "w: "+event.width, "h: "+event.height]+"
");
        }
                            
        private function onItemError(event:QueueLoaderEvent):void {
            trace("
>>"+event.type+"
");
        }
                            
        private function onQueueComplete(event:QueueLoaderEvent):void {
            trace("** "+event.type);
        }
    } 

Event.COMPLETE Not Dispatching In Browsers
Im loading a jpg using a Loader object. when the Event.COMPLETE is dispatched, i resize the image. If i run the swf in the Flash player, it runs fine.. BUT when i run it in a browser from a HTTP server the Event.COMPLETE is NOT dispatching!!! (any browser)

heres the script:


ActionScript Code:
var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("http://www.modernlifeisrubbish.co.uk/images/illustrations/google-as-a-giant-robot.jpg");

ldr.load(urlReq);
addChild(ldr);

ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(event:Event):void
{
    var contt:Bitmap = event.target.content;
    contt.scaleY = .5;
    contt.scaleX = .5;
}


any ideas how to resize the image when the file is loaded? (I also want to addChild after its loaded)

Getting Event.COMPLETE To Run After Database Save
Hi Guys,

Im developing an application in as3 that talks to an sql database through some php. Currently im connecting to the database as follows:


ActionScript Code:
var myData:URLRequest = new URLRequest("somePHP.php")
               
                myData.method = URLRequestMethod.POST
                var variables:URLVariables = new URLVariables()
                variables.someVar = "hello";
                var loader:URLLoader = new URLLoader()
                loader.dataFormat = URLLoaderDataFormat.VARIABLES
                loader.addEventListener(Event.COMPLETE, savedData)
                loader.load(myData)

The previous code is used to connect to the database and save some info. As far as im aware the line:


ActionScript Code:
loader.addEventListener(Event.COMPLETE, savedData)

Should then run the function savedData when the data has been saved. However i cant get this to happen. the information is getting saved fine, i just cant seem to get it to run a function once its done. Any help would be much appreciated.

Cheers,

Lk

Loader Event.COMPLETE Problem
Hi,

I hope someoen might have an idea of what's wrong here.

I have a Loader loading a PNG over the network (vars have been scoped in class):
********
request = new URLRequest("image.png");
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Progress Event.PROGRESS,loadProgress);loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR,loadError);
loader.contentLoaderInfo.addEventListener(HTTPStat usEvent.HTTP_STATUS,httpStatus);
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, loadComplete);
loader.load(request);
*********
This works fine for one png, but when I switch to another I get the problem. In the second case the progress events are triggered up to 100%, but the Complete event is never fired. There are also no IO_Error triggered.

The only difference is the two pngs. The one that refuses to trigger is larger (about 200K, rather than 20K). But thats it. The png will load fine in a browser.

Any ideas?!

Thanks,

S

FileReference Event.COMPLETE Is Useless?
I have a PHP script that uses ftp to upload, the thing is Flash doesn't give a crap if the file has been uplaoded to the server! Since from what I have seen and understand is that all it does is load the data to the PHP script and nothing else, right? Once it is done loading the data to the PHP script then thats its job done! And fires the complete event listener.

So I want to know, how can I determine if the actual file has been uploaded, I guess I have to make use of my PHP script to tell Flash if its done or not? Or is there something else that I can do with Flash to tell me if its actually uploaded the file?

Thanks all

URLLoader Event.Complete Question
Hello,
I suspect this is a trivial isssue, but depsite numerous searches, I can't find any answers to my question.

I rune the following code from TestClass:


ActionScript Code:
handler.loadFromFile("test5.txt");
dataset.generateComplete();

In handler's class, I have the following code:


ActionScript Code:
public function loadFromFile(fname:String) {
    var pointsLoader:URLLoader = new URLLoader();
    pointsLoader.addEventListener(Event.COMPLETE, onFileLoaded);
    pointsLoader.load(new URLRequest(fname));
}
       
private function onFileLoaded(event:Event):void {
    pointList = event.target.data.split("
");
}
       
public function getPointList():Array {
    return pointList;
}

And finally, dataset's class has the following code:

ActionScript Code:
public function generateComplete():void {
    var pointList:Array = myHandler.getPointList();
        ..........

Seems straightforward.

However, why does dataset.generateComplete(); get called before onFileLoaded(event:Event)?

I can only assume that this is the case, as var pointList:Array = myHandler.getPointList(); returns Null, and when I run some tests with trace statements, I can see that onFileLoaded(event:Event) is seemingly called after generateComplete()

I'm confused. Is the URLLoader process running in parallel to the rest of the application?

FlvPlayback Complete Event Does Not Fire
I am using the FlvPlayback component to play a number of Flash videos. When a video completes, I need some code to run. My script is working correctly, however, the "complete" event does not fire with some flv files. All of the flv files were created the same way using Flash 8 Video Encoder. I'm hoping someone can give me a work around to this problem.







Attach Code

var listener:Object = new Object();
listener.complete = function(eventObject:Object):Void {
...
};
flvPlayer.addEventListener("complete", listener);

Event Handler For Sound Complete
Hello Flash Forum,

I borrowed some code from the Adobe livedocs area. This would be on how to use SoundChannel and Sound classes.
I used the sample code to play and pause a sound. It changes the text label on a textfield from "PLAY" to "PAUSE".

this file will play my audio fine. It will not replay the audio. The pause feature works fine, and the audio plays on when I click the button, but as mentioned above will not replay the audio.

I figure I would add an event listener for the channel (Event.SOUND_COMPLETE) (see code below). At one point I had the code responding to the sound complete. But it no longer responds to the event. What is wrong with my code?? I instantiate the class "SoundChannelExample" on a flash document, do an addChild(textAudio); to get the button on my stage.

Hints or tips will be greatly appreciated.

Thanks,

eholz1

code is attached







Attach Code

CODE:
package {
import flash.display.Sprite;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.text.TextFieldAutoSize;

public class SoundChannelExample extends Sprite {
private var snd:Sound = new Sound();
private var channel:SoundChannel = new SoundChannel();
private var button:TextField = new TextField();
private var sndComplete:Boolean;

public function SoundChannelExample() {
var req:URLRequest = new URLRequest("eed_description.mp3");
snd.load(req);

button.x = 10;
button.y = 10;
button.text = "PLAY";
button.border = true;
button.background = true;
button.selectable = false;
button.autoSize = TextFieldAutoSize.CENTER;

button.addEventListener(MouseEvent.CLICK, clickHandler);

this.addChild(button);
sndComplete = false;
}

/*** the function below is not called when the audio complete ***/
private function soundCompleteHandler(e:Event):void
{
button.text = "PLAY";
sndComplete = true;
//trace("sound complete, stopping channel");
channel.removeEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
}

private function clickHandler(e:MouseEvent):void {
var pausePosition:int = channel.position;

channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);

if(button.text == "PLAY" )
{
channel = snd.play(pausePosition);
button.text = "PAUSE";
} else {
channel.stop();
button.text = "PLAY";
}

}
}
}

How To Trigger An Event On Video Complete
I am trying to build my first AS 3.0 project
using examples from O'relliy. I'm a noob, so bear with me.

I have loaded an FLV using the NetStream class. I added an Event
Listener find out when the video has finished playing, probably not the right method. After the
video finishes, I'd like to load a static image and a replay button.

What should I use to trigger these things to load? What should I use to load them?


Many thanks in advance.
Jamie







Attach Code

Here is my script:

//From http://safari.oreilly.com/1596713461 Ch 11 Loading Video

// Create the Net Connection
var videoConnection:NetConnection = new NetConnection();

// Set it to null unless connecting to a server
videoConnection.connect(null);

// Create the Net Stream and pass in the NetConnection
var videoStream:NetStream = new NetStream(videoConnection);

// Have the NetStream play the video
videoStream.play("flv/fishClip.flv");

//From Ch 11

//Create the Object
var metaListener:Object = new Object();
//Associate it with onMetaData
metaListener.onMetaData = onMetaData;
//Associate it with videoStream (NetStream)
videoStream.client = metaListener;

// EndFrom Ch11
// Create a new Video object
var video:Video = new Video(735,350);

// Attach the NetStream to the video
video.attachNetStream(videoStream);

// Put the video on the stage
addChild(video);

//From http://safari.oreilly.com/1596713461 Ch 11 Controlling video
playback

function onMetaData(data:Object):void
{
//Nothing
}

// Here is where I get lost
videoStream.addEventListener(NetStatusEvent.NET_STATUS,
statusHandler);
function statusHandler(event:NetStatusEvent):void
{
trace("Listener Added!")

{
switch (event.info.code)
{
case "NetStream.Play.Start":
trace("Start [" + videoStream.time.toFixed(3) + " seconds]");
break;
case "NetStream.Play.Stop":
trace("Stop [" + videoStream.time.toFixed(3) + " seconds]");
break;
}
}
}

Event.COMPLETE On Loader With Target
When adding a listener to loading content for complete how do I retain the name or id of that loaded content? Basically I'm loading an image or swf and I want text to load over top, but I need the width and height of the loaded content so I can resize the text box. So I need to wait until it's loaded to ascertain the width and the height, but contentLoaderInfo doesn't pass the target info to the function. So what the eff?

Also, I'm assigning the load_menu a name, but is there an id or some reference I can retain to remove this from the stage at a later time? I'm new to AS3 so this is all very confusing for me.


var load_menu:Loader = new Loader();
load_menu.x = x;
load_menu.y = y;
load_menu.name = menus[j].name();
load_menu.load(load_file);

addChild( load_menu );

//---------------------------------------------//
//
// Add an onLoad handler to resize the text
//
//---------------------------------------------//
load_menu.contentLoaderInfo.addEventListener(Event .COMPLETE,

function(event:Event):void {

------> What the heck goes here? <----

}

);
//---------------------------------------------//

Event.Complete Of FileReference Class
Hi there,

i am currently programming an as3 uploader and i've just run into a pretty annoying issue.
It seems that there is a bug in the Mac Flash Player which causes the dispatch of the FileReference's 'Event.Complete' to fail. It all works fine on windows.

I managed to get around this problem by checking the completion of the upload with the 'ProgressEvent', but stupidly enough this will on work with files larger than approx. 100kb. Otherwise the ProgressEvent won't be dispatched and I would not be able to check whether an upload is done.

Has anyone any suggestions how one could solve this problem? Any workarounds?

Accessing An Event.COMPLETE Listener
I'm having problems accessing a Event.COMPLETE listener for loading a php file:


Code:
function prepareD(){
//more code before
var hsloader:URLLoader = new URLLoader();
hsloader.dataFormat = URLLoaderDataFormat.VARIABLES;
hsloader.addEventListener(Event.COMPLETE, highSdata);
hsloader.load(myData);
//more code after

}
function highSdata(evt:Event){
if(evt.target.data.highS<(Math.round(musicC/musicL*100))) {
//code
}
}
What is happening is I'm creating a new URLloader, then loading the php, and I create a Event.COMPLETE listener, but when the load completes (I've tested with navigateToURL), the listener doesn't trigger. I've also tried putting the var before functions, but it doesn't work either... Any ideas?

Thanks!

Loader Class Not Firing Event.COMPLETE
I'm having a problem that's got me stuck in AS3. I have this seemingly simple code:


PHP Code:



var loader:Loader = new Loader();
loader.addEventListener(Event.COMPLETE, function(event:Event):void{
    trace('hi');
});
loader.load(new URLRequest('photo.jpg'));




The event.complete is never firing. Nothing I do works. If I make it a URLLoader and not a regular Loader it goes through fine and the event is fired, however this is an image I need to add to the stage so I need to use a Loader. But I can't figure out for the life of me why the event.complete isn't firing. I know it's loading because I can add the loader to the stage and the image shows up. Doesn't matter if I do local images or images from a server. What's going on here?

Loader Class Not Firing COMPLETE Event
Hello hello,

So I've got a bit of a problem that is absolutely puzzling me.

I've got a custom Thumbnail class that reads in an image path, a label, and an index. The class simply loads the image and and onComplete it pulls the bitmap out of loader.content, assigns it to a public variable and then dispatches an event saying its completed.

I use these thumbnails in a thumbnail gallery and I don't build the gallery in until all thumbnails are loaded and ready. The problem is the COMPLETE event doesn't always fire for every thumbnail, therefore not allowing the gallery to build.

I used a ProgressEvent.PROGRESS to make sure the files were being loaded, and found that when the loads failed the loader still loaded the totalBytes.

I've also tried Event.INIT and its the same issue.

INIT and COMPLETE just don't seem to be either caught or dispatched.

If anyone is familiar with a problem like this I'd appreciate any help that you could provide.

Thanks in advance.


Code:
public class Thumbnail extends Sprite
{
/******************************************************************************************
* VARIABLES
*****************************************************************************************/

public var label: String;
public var link: String;
public var imagePath: String;
public var index: int;

protected var image: Bitmap;
protected var loader: Loader;


/******************************************************************************************
* CONSTRUCTOR
*****************************************************************************************/
public function Thumbnail(p_imagePath: String, p_label: String = "", p_index: int = 0)
{
//init variables
imagePath = p_imagePath;
label = p_label;
index = p_index;

//setup the loader and the onComplete
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoadComplete, false, 0, true);
loader.load(new URLRequest(imagePath));
}

/******************************************************************************************
* DECONSTRUCTOR
*****************************************************************************************/
public function destroy():void
{
loader = null;
}

/******************************************************************************************
* EVENT HANDLERS
*****************************************************************************************/

/**
* Handles the loader event when the image loading is done
**/
private function onLoadComplete(evt: Event):void
{
image = Bitmap(loader.content);
addChild(image);
dispatchEvent(new Event(Event.COMPLETE));
}



}

URLLoader Event.COMPLETE Failing To Fire
I am submitting simple name value pairs to a php login script on the server, and it responds consistently, but the URLLoader instance Event.COMPLETE listener only fires sporadically. Manually reading the data object from the URLLoader instance shows the data is even present. But the listener only fires for the comlete event 30% of the time. Any ideas? I have tried both post and get method neither working consistently.

thanks,

URLLoader Complete Event Not Dispatched While Streaming Mp3
Hi all,

i'm trying to load binary data using the URLLoader object while a
sound object is streaming an mp3.

However, the COMPLETE event is only dispatched as soon as i stop
the audio stream.

here's the code snippets where i create the objects:

Class A

Code:
this.sound = new Sound(new URLRequest(someUrl), this.context);

Class B

Code:
var myData : URLRequest = new URLRequest(anotherUrl);
this.loader.load(myData);
this.loader.addEventListener(Event.COMPLETE, readData);
The readData() method is only called after stopping the audio stream.

Am i missing something obvious here ?

thanks!

Is It Possible To Access URLRequest From URLLoader Once Event.COMPLETE
hello;

I have:

ActionScript Code:
//--------------------------------------------------------------------------
my_handle_URLLoader_complete = function( argo_event : Event  ) : void
  { var lvo_loader : URLLoader = URLLoader ( argo_event.target ) ;
    //  the lvo_loader does indeed have the correct return from the php script;
   
    //   however I would like to access some of the variables that had been originally sent as part of the URLRequest   
    trace( lvo_loader.the_URLRequest_reference[ "my_sent_variable" ] ) ;
  }

any thoughts?


thanks
Shannon

Preloader Event.COMPLETE Annoying Thing
Hi Everyone

I'm sure someone knows a quick answer for this:

The preloader I usually use executes an addChild(loadedMovie) statement in response to an Event.COMPLETE event from the loaded swf's contentLoaderInfo object (a common approach, I believe.) The problem with this (as many of us know) is that the loaded swf starts running before the Event.COMPLETE event gets thrown, which means that once the child is added, it is already a few frames into its timeline. What I need is a way for the loaded swf not to start playing til its COMPLETE event gets thrown. Any ideas on how to do this (or some other workaround) ?

Thanks In Advance,
Graham

Get The Object Being Loaded Within Event.Complete Function?
I am applying loader.contentLoaderInfo listeners to object in a loop. Is there a way to get the object that has called the Event.Complete and the associated function?

for example:

private function completeHandler(event:Event):void {
trace (the Loader object that called this function);
}

???

It seems like there would be something similar to 'event.target' but I understand that it is the contentLoader that has the eventListener applied to it. Thanks!





























Edited: 11/27/2007 at 02:40:30 AM by masterkrang

Preloader Event.COMPLETE Annoying Thing
Hi Everyone

I'm sure someone knows a quick answer for this:

The preloader I usually use executes an addChild(loadedMovie) statement in response to an Event.COMPLETE event from the loaded swf's contentLoaderInfo object (a common approach, I believe.) The problem with this (as many of us know) is that the loaded swf starts running before the Event.COMPLETE event gets thrown, which means that once the child is added, it is already a few frames into its timeline. What I need is a way for the loaded swf not to start playing til its COMPLETE event gets thrown. Any ideas on how to do this (or some other workaround) ?

Thanks In Advance,
Graham

Preloader Complete Event Firing Too Early
Hello guys,

I am currently building a preloader for my movie and have the following code:


ActionScript Code:
var websiteLoader:LoaderInfo = this.loaderInfo;websiteLoader.addEventListener(ProgressEvent.PROGRESS, loaderProgressHandler);websiteLoader.addEventListener(Event.COMPLETE, onLoaderComplete);function loaderProgressHandler(event:ProgressEvent):void{    //When loading    var loaderBar:MovieClip = loaderbar_mc;    var loaderMask:MovieClip = loadermask_mc;            var loadedPercentage:int = (Math.ceil(event.bytesLoaded / event.bytesTotal));        loaderBar.x = (loadedPercentage*loaderMask.width) + loaderMask.x;    }        function onLoaderComplete():void{    trace("completed");    //When loading completes    websiteloader_mc.play();                        websiteLoader.removeEventListener(ProgressEvent.PROGRESS, loaderProgressHandler);    websiteLoader.removeEventListener(Event.COMPLETE, onLoaderComplete);}


On the first frame, I have the preloader assets. On the second frame, assets that are exported for actionscript but set to not export at first frame. On the third frame, I have the actual website.

Now the issue is this, people testing it over internet connections and me testing it flash with simulate download will see the following issue:

The movie will load, COMPLETE will fire causing the movie to play. But the movie hasn't fully loaded yet, so it will play frame 2 when it should play frame 3. Various testing has shown that the movie has not fully loaded yet, but tracing bytesLoaded will show that it is equal to bytesTotal.

Any ideas appreciated

Uh...why Doesn't The Loader Class Have A Complete Event?
I don't get it. I'm using a Loader and I see it has no complete event. What's going on here? How do i fire an event when my image has loaded?

AS3 - MovieClip Animates On Event.COMPLETE Handler
Hello Shockers,

Why is that when you add your MovieClip on the stage via an Event.COMPLETE handler, it animates the content of your MovieClip?

This MovieClip of mine is actually a button, with an over and out animation inside it. Even if there's a stop function on the first frame, it still animates it. Really weird.

Here's my AS



ActionScript Code:
function init ()
{
    var req:URLRequest = new URLRequest('config.xml');
    var ul:URLLoader = new URLLoader();
    ul.addEventListener ('complete', ullistener);
    ul.load (req);
}
function ullistener (e:Event)
{
    addChild (new Product());
}

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