I have the following property defined in my webcam as3 webcam class
public function get paused():Boolean
{
return (cam == null);
}
public function set paused(p:Boolean):void
{
if(p){picture.draw(vid,flip);cam = null;}
else cam = Camera.getCamera();
vid.attachCamera(cam);
}
Is it possible to access this from javascript? When I had it as a simple function it worked with:
ExternalInterface.addCallback("paused", paused);
But that wont compile after I changed it to properties.
"Error: Implicit coercion of a value of type Boolean to an unrelated type Function."
I'm an actionscript newbie so maybe there's something obvious I'm missing.
addCallback()
only accepts a function, so you'll need to create meaningful functions that set and get the value without the use of the get
and set
keywords:
function getPaused():Boolean
{
return paused;
}
function setPaused(value:Boolean):void
{
paused = value;
}
ExternalInterface.addCallback("getPaused", getPaused);
ExternalInterface.addCallback("setPaused", setPaused);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.