Hi,
I'm currently modifying the interface example "flashcs3exampleplugin11",
and i don't know where to place my register/update Event and their functions,
syntax seems differents in actual documentation...
where should i put :
Code
krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_RESIZE, resizeEvent);
krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_UPDATE, updateEvent);
because Flash throw me errors
first i had this :
Code
// import krpano as3 interface.as //
import krpano_as3_interface;
// create krpano as3 interface object - krpano
var krpano:krpano_as3_interface = krpano_as3_interface.getInstance();
// empty functions? - then it wasn't included in the viewer
if (krpano.get == null)
{
// run plugin swf standalone - no interfaces - add dummy functions
function dummy_get(v:String):String
{
if (v != "progress.loaddone") // avoid progress timer traces
trace("get(" + v + ");");
return "";
}
function dummy_set(v:String,val:String):void
{
trace("set("+v+","+val+");");
}
function dummy_call(action:String):void
{
trace("call("+action+");");
}
krpano.get = dummy_get;
krpano.set = dummy_set;
krpano.call = dummy_call;
}
if (stage)// run standalone
{
stage.scaleMode = StageScaleMode.NO_SCALE;// no automatic scaling
stage.align = StageAlign.TOP_LEFT;// align on top left corner
startup_plugin(null);
}
else // run as plugin in krpano
{
this.addEventListener(Event.ADDED_TO_STAGE, startup_plugin);
}
//
krpano.call("loadpano(%HTMLPATH%/params.xml,null,KEEPBASE|KEEPPLUGINS,BLEND(1));");
function startup_plugin(event:Event):void
{
stage.addEventListener(Event.RESIZE, stage_resize);// setup a global RESIZE event to set the positions of all elements when resizeing
stage.addEventListener(FullScreenEvent.FULL_SCREEN, stage_fullscreen_event);// add a Fullscreen event to make changes when switching to fullscreen and back
//
stage_resize(null);// do a first resize
//
get_current_values();
}
Alles anzeigen
this works fine with no errors,but no attributes reading here....
then after i modify to this :
Code
// import krpano as3 interface.as //
import krpano_as3_interface;
// create krpano as3 interface object - krpano
var krpano : krpano_as3_interface = null;
// empty functions? - then it wasn't included in the viewer
if (krpano.get == null)
{
// run plugin swf standalone - no interfaces - add dummy functions
function dummy_get(v:String):String
{
if (v != "progress.loaddone") // avoid progress timer traces
trace("get(" + v + ");");
return "";
}
function dummy_set(v:String,val:String):void
{
trace("set("+v+","+val+");");
}
function dummy_call(action:String):void
{
trace("call("+action+");");
}
krpano.get = dummy_get;
krpano.set = dummy_set;
krpano.call = dummy_call;
}
if (stage)// run standalone
{
stage.scaleMode = StageScaleMode.NO_SCALE;// no automatic scaling
stage.align = StageAlign.TOP_LEFT;// align on top left corner
startup_plugin(null);
}
else // run as plugin in krpano
{
this.addEventListener(Event.ADDED_TO_STAGE, startup_plugin);
}
//
krpano.call("loadpano(%HTMLPATH%/params.xml,null,KEEPBASE|KEEPPLUGINS,BLEND(1));");
function startup_plugin(event:Event):void
{
krpano = krpano_as3_interface.getInstance();
krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_RESIZE, stage_resize /*resizeEvent*/);
krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_UPDATE, updateEvent);
stage.addEventListener(Event.RESIZE, stage_resize);// setup a global RESIZE event to set the positions of all elements when resizeing
stage.addEventListener(FullScreenEvent.FULL_SCREEN, stage_fullscreen_event);// add a Fullscreen event to make changes when switching to fullscreen and back
//
stage_resize(null);// do a first resize
//
get_current_values();
}
Alles anzeigen
and this time Flash throw me Error #1009 : impossible to access nul object...
what's wrong ??
what is the fix to be able to read/assign/update plugin xml attributes
Thanks
z