Skip to content

Commit

Permalink
avm2: DataEvent fixes
Browse files Browse the repository at this point in the history
- `DataEvent.data` should delegate to the superclass's `TextEvent.text`
- `DataEvent.clone` implementation was wrong
  • Loading branch information
Lord-McSweeney committed Nov 10, 2023
1 parent b056e12 commit 172b76d
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions core/src/avm2/globals/flash/events/DataEvent.as
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,34 @@
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/DataEvent.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package flash.events
{
public class DataEvent extends TextEvent
{
package flash.events {
public class DataEvent extends TextEvent {
public static const DATA:String = "data"; // Defines the value of the type property of a data event object.
public static const UPLOAD_COMPLETE_DATA:String = "uploadCompleteData"; // Defines the value of the type property of an uploadCompleteData event object.

public var data: String; // The raw data loaded into Flash Player or Adobe AIR.
public function DataEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, data:String = "") {
super(type, bubbles, cancelable, data);
}


// `DataEvent.data` seems to delegate to the superclass's (TextEvent's) `TextEvent.text`.
public function get data():String {
return super.text;
}

public function DataEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, data:String = "")
{
super(type,bubbles,cancelable, data);
this.data = data;
public function set data(value:String):void {
super.text = value;
}


// Creates a copy of the DataEvent object and sets the value of each property to match that of the original.
override public function clone():Event
{
return new DataEvent(this.type, this.bubbles, this.cancelable, this.text, this.data);
override public function clone():Event {
return new DataEvent(this.type, this.bubbles, this.cancelable, this.data);
}

// Returns a string that contains all the properties of the DataEvent object.
override public function toString():String
{
override public function toString():String {
return this.formatToString("DataEvent","type","bubbles","cancelable","eventPhase","data");
}
}
}

0 comments on commit 172b76d

Please sign in to comment.