PDA

View Full Version : Custom Event Fired, yet not performing actions in method...Any ideas why?


Dashryder56
08-20-2009, 12:31 AM
I have a Custom Event that takes the name of a file uploaded through FileReference and bubbles the variable back up to the parent class. The Custom Event works and when traced in the parent class, it appears the variable came through as well and traces out in the output. However when trying to use this variable in the text field and assigning it anywhere in the parent class, nothing happens, not even an error. Any ideas why this is happening?

parent class
____________

package classes {

import classes.gs.*;
import classes.gs.easing.*;
import classes.FileUploader;
import classes.djw.events.io.*;
import classes.*;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;

public class Upload extends MovieClip{
public var image:String;
public var up:FileUploader;
private var systemGo:Boolean = false;

public function Upload() {
addEventListener(CustomEvent.CONTROL_TYPE, fileText);
}

private function fileText(evt:CustomEvent):void{
trace("CUSTOM EVENT WORKING IN UPLOAD...File is " + evt.command);
image = evt.command.toString();
//The Text file to be changed
this._form._imageBox._text.text = image;
trace("Selected File = " + image);
}


The CUSTOM EVENT
_____________________________
package classes{
import flash.events.Event;

public class CustomEvent extends Event{
public static const CONTROL_TYPE:String = "headControl";
public var command:String;

public function CustomEvent(command:String, bubbles:Boolean)
{
super(CONTROL_TYPE, bubbles);
this.command = command;
trace("CustomEvent constructor fired in CustomEvent.as...File = " + command);
}
}

}


The DISPATCH CALL (from another file extending the parent class "Upload.as")
______________________________
//the filename grabbed
var file:String = e.target.name;
dispatchEvent(new CustomEvent(file, true));