1

I'm trying to create a GIF animation class for actionscript 2. The problem is when I load the GIF, I only get the header. For example, the only data is 'GIF89a'. How do I get the remaining data?

import mx.utils.Delegate;
import LoadJson;

var reqData = new LoadJson();
var _response = new LoadJson();
reqData.contentType = 'image/gif';
var headers = ["Content-Type", "image/gif"]; 
reqData.addRequestHeader(headers);
reqData.sendAndLoad("http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Newtons_cradle_animation_book_2.gif/200px-Newtons_cradle_animation_book_2.gif", _response, 'GET');
_response.onData = Delegate.create(this, onComplete);

function onComplete(_data) {
    trace(_data);
    trace(_response.contentType);
}

.

class LoadJson extends LoadVars {
public var json:String;

public function toString() {
    return json;
}
}
Eddie
  • 1,428
  • 14
  • 24

1 Answers1

1

Not sure if you still need help with this as I found it while searching for something unrelated.

That being said, it looks like you should be using onLoad instead of onData to ensure that the sendAndLoad has fully completed and retrieved all data:

reqData.sendAndLoad("http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Newtons_cradle_animation_book_2.gif/200px-Newtons_cradle_animation_book_2.gif", _response, 'GET');
_response.onData = Delegate.create(this, onComplete);

Sources: http://help.adobe.com/en_US/as2/reference/flashlite/WS5b3ccc516d4fbf351e63e3d118cd9b5f6e-78c7.html - onLoad event summary http://help.adobe.com/en_US/as2/reference/flashlite/WS5b3ccc516d4fbf351e63e3d118ccf9c47f-7da5.html - sendAndLoad sample code at bottom of page

SnakeMan2058
  • 77
  • 1
  • 11
  • Thanks, I think your right with the networking part. Sadly, I gave up trying to do this as AS2 doesn't support binary, so making a gif class seemed impossible. – Eddie Nov 18 '15 at 22:42