hugene
11-13-2008, 10:56 PM
Hello, I've been playing all day with MXML, following the online doc. But now I am trying to do something more complicated:
I want to build a window where I can look at the input from my webcam.
So I have the following MXML
<?xml version="1.0"?>
<!-- mxml/TriggerCodeExample2.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script source="includes/CameraExample.as" />
<mx:Script><![CDATA[
public var cameraExample:CameraExample = new CameraExample;
]]></mx:Script>
<mx:Panel title="My Application"
paddingTop="10"
paddingBottom="10"
paddingLeft="10"
paddingRight="10"
>
<mx:Button label="Start Capture" click="cameraExample.CameraExample();"/>
</mx:Panel>
</mx:Application>
and the CameraExample.as is copied from here http://livedocs.adobe.com/flex/3/langref/flash/media/Camera.html#includeExamplesSummary
But I get the following compile error:
: col: 17 Error: Packages can
not be nested.
package {
Why is this happening?
I tried also creating a sub-directory called myCamera and put the CameraExample.as file there instead, and added myCamera after the package keyword. I then put xmlns:cmp="myCamera.*" in the mx:Application tag.
This doesn't work either, I get the following error:
: Error: Call to a possibly undef
ined method CameraExample through a reference with static type CameraExample.
<mx:Button label="Start Capture" click="cameraExample.CameraExample();"/>
I am lost here, seems like the code from CameraExample.as is not properly included in the MXML file. Can someone please advise me on the proper way to include and run CameraExample.as.
Thanks a lot
I want to build a window where I can look at the input from my webcam.
So I have the following MXML
<?xml version="1.0"?>
<!-- mxml/TriggerCodeExample2.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script source="includes/CameraExample.as" />
<mx:Script><![CDATA[
public var cameraExample:CameraExample = new CameraExample;
]]></mx:Script>
<mx:Panel title="My Application"
paddingTop="10"
paddingBottom="10"
paddingLeft="10"
paddingRight="10"
>
<mx:Button label="Start Capture" click="cameraExample.CameraExample();"/>
</mx:Panel>
</mx:Application>
and the CameraExample.as is copied from here http://livedocs.adobe.com/flex/3/langref/flash/media/Camera.html#includeExamplesSummary
But I get the following compile error:
: col: 17 Error: Packages can
not be nested.
package {
Why is this happening?
I tried also creating a sub-directory called myCamera and put the CameraExample.as file there instead, and added myCamera after the package keyword. I then put xmlns:cmp="myCamera.*" in the mx:Application tag.
This doesn't work either, I get the following error:
: Error: Call to a possibly undef
ined method CameraExample through a reference with static type CameraExample.
<mx:Button label="Start Capture" click="cameraExample.CameraExample();"/>
I am lost here, seems like the code from CameraExample.as is not properly included in the MXML file. Can someone please advise me on the proper way to include and run CameraExample.as.
Thanks a lot