avm2: Port `flash.net.URLLoaderDataFormat` to ActionScript
This commit is contained in:
parent
781954bd86
commit
8398dc4ae8
|
@ -876,11 +876,6 @@ pub fn load_player_globals<'gc>(
|
|||
script,
|
||||
)?;
|
||||
class(activation, flash::net::url_loader::create_class(mc), script)?;
|
||||
class(
|
||||
activation,
|
||||
flash::net::url_loader_data_format::create_class(mc),
|
||||
script,
|
||||
)?;
|
||||
class(
|
||||
activation,
|
||||
flash::net::url_request::create_class(mc),
|
||||
|
|
|
@ -3,5 +3,4 @@
|
|||
pub mod object_encoding;
|
||||
pub mod sharedobject;
|
||||
pub mod url_loader;
|
||||
pub mod url_loader_data_format;
|
||||
pub mod url_request;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package flash.net {
|
||||
public final class URLLoaderDataFormat {
|
||||
public static const TEXT: String = "text";
|
||||
public static const BINARY: String = "binary";
|
||||
public static const VARIABLES: String = "variables";
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
//! `flash.net.URLLoaderDataFormat` builtin/prototype
|
||||
|
||||
use crate::avm2::activation::Activation;
|
||||
use crate::avm2::class::{Class, ClassAttributes};
|
||||
use crate::avm2::method::Method;
|
||||
use crate::avm2::names::{Namespace, QName};
|
||||
use crate::avm2::object::Object;
|
||||
use crate::avm2::value::Value;
|
||||
use crate::avm2::Error;
|
||||
use gc_arena::{GcCell, MutationContext};
|
||||
|
||||
/// Implements `flash.net.URLLoaderDataFormat`'s instance constructor.
|
||||
pub fn instance_init<'gc>(
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Option<Object<'gc>>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error> {
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
/// Implements `flash.net.URLLoaderDataFormat`'s class constructor.
|
||||
pub fn class_init<'gc>(
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Option<Object<'gc>>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error> {
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
/// Construct `URLLoaderDataFormat`'s class.
|
||||
pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> {
|
||||
let class = Class::new(
|
||||
QName::new(Namespace::package("flash.net"), "URLLoaderDataFormat"),
|
||||
Some(QName::new(Namespace::public(), "Object").into()),
|
||||
Method::from_builtin(
|
||||
instance_init,
|
||||
"<URLLoaderDataFormat instance initializer>",
|
||||
mc,
|
||||
),
|
||||
Method::from_builtin(class_init, "<URLLoaderDataFormat class initializer>", mc),
|
||||
mc,
|
||||
);
|
||||
|
||||
let mut write = class.write(mc);
|
||||
|
||||
write.set_attributes(ClassAttributes::SEALED | ClassAttributes::FINAL);
|
||||
|
||||
const CONSTANTS: &[(&str, &str)] = &[
|
||||
("BINARY", "binary"),
|
||||
("TEXT", "text"),
|
||||
("VARIABLES", "variables"),
|
||||
];
|
||||
|
||||
write.define_public_constant_string_class_traits(CONSTANTS);
|
||||
class
|
||||
}
|
|
@ -32,6 +32,7 @@ include "flash/geom/ColorTransform.as"
|
|||
include "flash/geom/Orientation3D.as"
|
||||
include "flash/geom/Point.as"
|
||||
include "flash/geom/Rectangle.as"
|
||||
include "flash/net/URLLoaderDataFormat.as"
|
||||
include "flash/text/AntiAliasType.as"
|
||||
include "flash/text/FontStyle.as"
|
||||
include "flash/text/FontType.as"
|
||||
|
|
Loading…
Reference in New Issue