-
Flash & JavaScript
I'm trying to get flash to toggle a div layers display status.
I have an html version working, but i can't seem to code it properly in AS3
I need to figure out how to issue something like:
<a href="javascript:toggleLayer('componentLevel2');" title="toggle">
toggle
</a>
within this function
function loadBuildingBenefits(event:MouseEvent):void {
// send the methodToExecute method in another movie's
// LocalConnection listening to "lc_example"
outgoing_lc.send("lc_component1", "playBenefitsText");
outgoing_lc.send("lc_example", "playBuildingBenefits");
}
-
-
Thank you.
I thought i had it, but this doesn't seem to do anything, but compiles w/o errors.
import flash.net.LocalConnection;
import flash.external.ExternalInterface;
// create a new LocalConnection instance used to listen
// for calls from a LocalConnection instance from another movie
var incoming_lc:LocalConnection = new LocalConnection();
var componentLevel2 = "componentLevel2";
// create a local connection listening to a connection
// with the name "lc_example"
incoming_lc.connect("lc_component1");
// define an method which will be called when a message
// is sent from a LocalConnection instance from another movie
function playBenefitsText():void {
trace("Component 1 should received GREEN BENEFITS data");
gotoAndStop(11);
ExternalInterface.call("toggleLayer", componentLevel2);
}
function playLEEDText():void {
trace("Component 1 should received LEED data");
gotoAndStop(21);
}
function playStrategiesText():void {
trace("Component 1 should received LEED data");
gotoAndStop(35);
}
// set the client reference of the LocalConnection instance
// to the object containing the method needing to be called
incoming_lc.client = this;
-
actually thats causing the flash application to lock up on my macbook pro....
-
moved to the AS 3.0 forum.
gparis
-
I'm not particularly familiar with LocalConnection, so I don't know if that's where your problem lies. But on the ExternalInterface side of things, you may want to move the call to toggleLayer up to before the gotoAndStop(11).
That's a shot in the dark, honestly. What sort of trace output are you getting?
-
[edit]Oops, I should have read the post more thoroughly! Sorry![/edit]