A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Need new eyes to look at this Cs3 vs Cs5 AS3

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    6

    Need new eyes to look at this Cs3 vs Cs5 AS3

    Hi formarians

    I have a cs3 project that works fine that saves an image out and sends back to a html page.

    We updated the project to cs5 and now it does not redirect back to the right URL. Only differences are in the below script. I been lookingat this for days without getting any where so would like some fresh eyes to have a look to see if there is glaring issues with the code.

    CS3 working code

    PHP Code:
    function onSaveClick(evt:MouseEvent):void 
    {
        var 
    snapshot:BitmapData = new BitmapData(600,340,false)
        
    snapshot.draw(mainTimeLine.main as DisplayObject);
        
    //var bd:BitmapData = snapshot.bitmapData;
        
    var imageData:ByteArray PNGEnc.encode(snapshot);
        var 
    encoder:Base64Encoder = new Base64Encoder(); 
        
    encoder.encodeBytes(imageData);    
        
        var 
    req:URLRequest = new URLRequest();
        var 
    variab:URLVariables = new URLVariables();                         
        
        
    variab.rim_id mainTimeLine.main.rimid;
        
    variab.car_id mainTimeLine.main.carid;    
        
    variab.image encoder.flush();         
        
        
    req.url this.root.loaderInfo.parameters.postURL;            
        
    req.data variab;    
        
    req.method URLRequestMethod.POST;        
        
    navigateToURL(req"_self");    
    }

    this.sav.visible true
    CS5 not working code

    PHP Code:
    function onSaveClick(evt:MouseEvent):void 
    {
        
    loadStart();
        var 
    snapshot:BitmapData = new BitmapData(600,340,false)
        
    snapshot.draw(main as DisplayObject);
        
    //var bd:BitmapData = snapshot.bitmapData;
        
    var imageData:ByteArray PNGEnc.encode(snapshot);
        var 
    encoder:Base64Encoder = new Base64Encoder(); 
        
    encoder.encodeBytes(imageData);    
        
        var 
    req:URLRequest = new URLRequest();
        var 
    variab:URLVariables = new URLVariables();                         
        
        
    variab.rim_id main.rimid;
        
    variab.car_id main.carid;    
        
    variab.image encoder.flush();         
        
        
    req.url getFlashVars().postURL;            
        
    req.data variab;    
        
    req.method URLRequestMethod.POST;        
        
    navigateToURL(req"_self");    
    }

    head.sav.visible true
    I have tried using:

    mainTimeLine.main.rimid in CS5
    and
    req.url = this.root.loaderInfo.parameters.postURL;

    Any ideas would be welcome.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    In the CS5 code you have another function loadStart(); . Also you need to do traces to see what you get.
    - The right of the People to create Flash movies shall not be infringed. -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center