1 dynamic change the style on runtime
the name parameter is a swf file that is compiled by a css file
etc:'style1.swf'
2 alert function
3 reflection invoke
my class
invoke method show
you can use the pranaframework,it supply some packages ,include reflection
for example
you can get the framework on
sourceforge.net/projects/prana/
as 代码
- import mx.styles.StyleManager;
- import mx.events.StyleEvent;
- var styleEvent:IEventDispatcher = StyleManager.loadStyleDeclarations( name, true );
the name parameter is a swf file that is compiled by a css file
etc:'style1.swf'
2 alert function
as 代码
- import mx.controls.Alert;
- Alert.show('');
3 reflection invoke
my class
as 代码
- package com.firebow
- {
- import mx.controls.Alert;
- public class Caller
- {
- public function show(str:String="abc",other:String=null):void
- {
- Alert.show(str);
- }
- }
- }
as 代码
- var classReference:Class = flash.utils.getDefinitionByName("com.firebow.Caller") as Class;
- var instance:Object=new classReference();
- var args:Array=new Array();
- args[0]="abc";
- args[1]="null";
- instance["show"].apply(instance,args);
you can use the pranaframework,it supply some packages ,include reflection
for example
as 代码
- var type:Type =Type.forInstance(instance);
- trace(type.name); // outputs "MyClass"
- trace(type.fullName); // outputs "com.domain::MyClass"
- trace(type.methods);
- trace(type.staticConstants);
- trace(type.staticVariables);
- trace(type.constants);
- trace(type.variables);
- for(var i:int=0;i
- {
- var m:Method=type.methods[i];
- trace("method:"+m.name);
- if(m.name=="show"){
- m.invoke(instance,"KKK");
- }
- }