[flexcoders] Probleme Upload File de flex vers PHP

2007-12-05 Thread exuperok
 Hello How should understand this trace when uploading file to php
application:

what does eventPase = 2 means? same thing for bubbles=false?
[CODE]
progressHandler: name=4-nov-2007.gpx bytesLoaded=32768 bytesTotal=169869
progressHandler: name=4-nov-2007.gpx bytesLoaded=65536 bytesTotal=169869
progressHandler: name=4-nov-2007.gpx bytesLoaded=98304 bytesTotal=169869
progressHandler: name=4-nov-2007.gpx bytesLoaded=131072 bytesTotal=169869
progressHandler: name=4-nov-2007.gpx bytesLoaded=163840 bytesTotal=169869
progressHandler: name=4-nov-2007.gpx bytesLoaded=169869 bytesTotal=169869
completeHandler: [Event type=complete bubbles=false cancelable=false
eventPhase=2]
[DataEvent type=uploadCompleteData bubbles=false cancelable=false
eventPhase=2 data=0][/CODE]

Print this message
Report this to a Moderator
OptimusFlex

User is online
Junior Member Posts:4
Joined: 11/16/2007
Send Private Message


12/05/2007 10:59:01 AM New Messages

Reply  | Quote  | Top  | Bottom  | Edit

first code is flex, the second one is php, i would ike to know if they
do the same thing: upload a file to
http://server.com/plateform/ul/index.php?


[CODE]?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=400
height=300
initialize=init()


mx:Script
![CDATA[
import com.project.community.model.CommunityModel;
import com.project.community.model.EditorModel;
import mx.controls.Alert;
import mx.controls.ProgressBar;
import mx.utils.ObjectUtil;
import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;

/**
*
*/
private const UPLOAD_URL : String =
http://server.com/plateform/ul/index.php;;


private var _progressBar: ProgressBar = new ProgressBar();
private var _fileRef : FileReference = new FileReference();
private var _gpsTypes : FileFilter = new FileFilter(Text Files
(*.gpx), *.gpx);




public function init() : void
{
initListener();
}



public function initListener() : void
{
submit.addEventListener(MouseEvent.CLICK, submitClickHandler);
back.addEventListener(MouseEvent.CLICK, backClickHandler);

_fileRef.addEventListener(Event.SELECT, fileSelectedHandler);
_fileRef.addEventListener(ProgressEvent.PROGRESS, progressEventHandler);

_fileRef.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
_fileRef.addEventListener(Event.COMPLETE, uploadCompletedHandler);
_fileRef.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
_fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,
serverResponseHandler);
}


public function httpStatusHandler(event:HTTPStatusEvent): void
{
trace(httpStatusHandler:  + event);
}



/*public function httpStatusHandler(event:HTTPStatusEvent):void
{

if (event.status != 200)
{
if (event.status == 500){
mx.controls.Alert.show(Probleme d'écriture,Error);
return;
}
if (event.status == 404){
mx.controls.Alert.show(Fichier non trouvé,Error);
return;
}
if (event.status == 415){
mx.controls.Alert.show(Type de media interdit,Error);
return;
}
if (event.status == 401){
mx.controls.Alert.show(Acces refusé,Error);
return;
}
mx.controls.Alert.show(Erreur +event.status,Error);
}
}
*/




/**
* function that handles the event: click on browse button
*/
public function fileSelectedHandler(event : Event) : void
{

selectedfile.text = _fileRef.name;
progressBar.setProgress(0, 100);
//progressBar.label = Loading 0%;
enabled = true;
//trace(selectedfile.text);
}



/**
* function that handle the event: click on back button.
*/
public function submitClickHandler(event : MouseEvent) : void
{
var params : URLVariables = new URLVariables();
var uploadRequest : URLRequest = new URLRequest(UPLOAD_URL);
params.filename = _fileRef.name;
params.sk = CommunityModel.getInstance().serverSessionKey; //
9b166dc3b1a6bf702dfd87b825627b6a;
params.dk = 7ffcd213ac5e00a88a2968c6f3530aeb;
params.type = track;

//affichage de l'erreur exact retournée par Icelio
//params.view_error = true;


uploadRequest.method = URLRequestMethod.POST;
uploadRequest.data = params;
trace(uploadRequest.url);
trace(uploadRequest.data);
trace(params.filename);
_fileRef.upload(uploadRequest);


// progressBar.label = Uploading...;

// EditorModel.getInstance().changeEditor(EditorModel.C_NAVIGATOR_NUMBER);
}

public function progressEventHandler(event : ProgressEvent): void
{
var file:FileReference = FileReference(event.target);
trace(progressHandler: name= + _fileRef.name +  bytesLoaded= +
event.bytesLoaded +  bytesTotal= + event.bytesTotal);
_progressBar.setProgress(event.bytesLoaded, event.bytesTotal);

}

public function uploadCompletedHandler(event : Event):void
{
trace(completeHandler:  + event);

}



public function serverResponseHandler( event:DataEvent ) :void
{
trace(event);
var response : XML = XML( event.data );
trace(response);

}

/**
* function that handle the event: click on back button
*/
public function backClickHandler(e : MouseEvent) : void
{
EditorModel.getInstance().changeEditor(EditorModel.C_NAVIGATOR_NUMBER);
}




public function ioErrorHandler 

[flexcoders] Flexunit and Protected or Priovate method

2007-11-16 Thread exuperok
hello i have to integrate Fleunit testing into an existing/ongoing
project that have classes calling webservices. Those classes have two
types that methodes that are both declared like this override
protected methodname. I would like to know how one should proceed to
have a testcase on those methodes that are protected given that AS3
allow calls on method that are procted only from the class and the
ones that extend it...

and in general how would someone use flexunit to test the result of
XML-RPC calls?