I need to create a video player using OSMF . I want to seperate our mxml file from actionscript files . How can I do that ? I have a actionscript class file and I want to execute its constructor when mxml is loaded .
I have added creationComplete="initApp()" and on initApp I call var p = new myclass();
. Now in myclass() I am trying to add label programmatically
my_player.mxml
<?xml version="1.0" encoding="utf-8"?>
<!-- controls\videoplayer\VideoPlayerSimple.mxml-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="initApp()"
>
<fx:Script>
<![CDATA[
public function initApp(){
var p = new my_player("a");
}
]]>
</fx:Script>
</s:Application>
my_player.as
package
{
import mx.controls.Label;
import mx.core.Application;
import mx.events.FlexEvent;
import spark.components.Application;
public class my_player extends spark.components.Application
{
public function convey_player(a:String){
var label:Label = new Label();
label.text = "Testxxx";
addElement(label);
Alert.show("Hello");
}
}
}
But nothing is added to flash . Am I missing something ?