Connection question with Make Controller & Flash
Up to Flash
I re-posted this in the proper section.
I can't seem to get passed a couple basic things. I can make the connection to teh Controller just fine. However, when I go to make it through Flash, i seem to run into issues.
This test works.
/appled/0/state 0
When I use McHelper, I get errors "1046: Type was not found or was not a compile-time constant: McEvent.
If it can't find the McEvent class, it sounds like you haven't installed the Flash library successfully.
Which platform are you on, and are you using AS2 or AS3? Can you confirm how & where you've installed the MakingThings Flash components?
I am running...
MAC OSX 10.4
ActionScript 3.0 (flash 9/cs3)
The com folder is in Adobe Flash CS3/configuration/ActionScript 3.0 / Classes / com / ...
I did see that I had the folder in the wrong place. (Not in the classes folder) so now i get a proper connection "new XML connection" however, when I go to run the flash LED file, I can't get the LED on the board to turn on. Seems like something is not correct as far as the communication from flash to the board. Do I need to tell it what board? In my sumary of McHelper I don't have any information regarding board type. Could that be an issue?
It looks like I need to tell it what board. (http://www.makingthings.com/documentation/tutorial/flash/tutorial-all-pages)
Is this at the rot of my communication issue?
I can't remember off the top of my head what the Flash LED file does. Do you ever get notified that a new board has been found? Does that get set as the default board? Then how are you sending messages to the board?
No in the sense of an extra message. (dialog box, etc...). I do see a message in the Make Controller Helper that a "new XML connection" has been made. This happens only after I have opened the movie file (Flash LED). What I see in the Make Controller Helper window is USB in the left panel and the messages in the right (Dialog panel). Nothing under the Summary panel at all and the Uploader is grayed. When I send a message to the board directly from McHelper I will type it into the send line and "hit" send. The board will light up the appropriate LED light. It's when I try to make the board light up that same LED with the Flash LED file and that is when it does not work. I don't see any messages saying that it didn't work... nothing happens unless I close the file and in the messages window area it will say that "XML peer disconnected".
Can you put some trace messages in your Flash file to see
1. if it connects to mchelper successfully (sounds like this is happening)
2. if it reports any boards are connected
Do you see any of the messages from your Flash movie showing up in mchelper?
I put a few traces in. I get to the "toggle" trace, which is down at the start of the toggle function. not sure why it stops here. However, I did set everything up o the PC. Works fine. The difference is Flash. I have FLASH 8 (actionscript 2) there. Could the problem be based in this?
//////////////////////////////////////////////////////////////////////
// Making Things 2006
// LED Control - turn an LED on the Application Board on and off.
import com.makingthings.makecontroller.*; // import the MakingThings library
addEventListener( Event.ENTER_FRAME, eachFrame );
var mcflash:McFlashConnect = new McFlashConnect( ); // our connection to mchelper
mcflash.addEventListener( McEvent.ON_BOARD_ARRIVED, onBoardArrived );
mcflash.connect( );
var boxState:Boolean;
trace ("Hello");
function onBoardArrived( event:McEvent )
{ trace ("BoardLoaded");
var newBoard:Board = event.data;
if( newBoard.location == "192.168.0.121" )
mcflash.setDefaultBoard( newBoard );
}
function eachFrame( e:Event )
{ trace ("toggle");
if( checkbox.selected != boxState ) //if the checkbox has changed
{
if( checkbox.selected ) // if it's selected, turn the LED on
{ trace ("toggleON")
var msg = new OscMessage( "/appled/0/state", [1] );
mcflash.sendMessage( msg );
}
else // otherwise turn it off
mcflash.send("/appled/0/state", [0] );
boxState = checkbox.selected; //store the state for the next comparison
}
}
////////////////////////////////////////////////////////
There are different example files in the ActionScript 2 download...if you're pasting this code (which looks like ActioScript 3) then I wouldn't expect that to work. Grab the LED file from the AS2 download and see how that works.
Powered by
Ploneboard

