mspanish
04-28-2009, 11:48 PM
Hello there - I have 2 SWFloaders in my Flex app, that correspond to a content box for lessons, and a virtual tutor box for videos. All of the content are AS3 swfs. I want to place buttons in my content so that I can change out the SWFs in either of the SWFLoaders in the Flex app. Does anybody know the code I would need in order to do that in my Flex app, as well as in my FLA files? A really crude demo of our curriculum page is here (just working on coding at this point, design is only bones!)
http://www.instaspanish.com/images/sample.jpg
Here is the code I'm using to load the SWFLoaders in the Flex app:
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function tree_itemClick(evt:ListEvent):void {
var t:Tree = evt.currentTarget as Tree;
var dataObj:Object = evt.itemRenderer.data;
if (dataObj.hasOwnProperty("@mainswf")) {
swfLoader.source = dataObj.@mainswf;
} else if (t.dataDescriptor.isBranch(t.selectedItem)) {
swfLoader.source = null;
panel.status = "";
}
}
private function tree_labelFunc(item:Object):String {
var suffix:String = "";
if (tree.dataDescriptor.isBranch(item)) {
suffix = " (" + item.children().length() + ")";
}
return item.@label + suffix;
}
private function swfLoader_complete(evt:Event):void {
panel.status = (swfLoader.bytesTotal/1024).toFixed(2) + 'KB';
}
]]>
</mx:Script>
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function tree_itemClick2(evt:ListEvent):void {
var t:Tree = evt.currentTarget as Tree;
var dataObj:Object = evt.itemRenderer.data;
if (dataObj.hasOwnProperty("@tutorswf")) {
swfTeacher.source = dataObj.@tutorswf;
} else if (t.dataDescriptor.isBranch(t.selectedItem)) {
swfTeacher.source = null;
panel.status = "";
}
}
private function tree_labelFunc2(item:Object):String {
var suffix:String = "";
if (tree.dataDescriptor.isBranch(item)) {
suffix = " (" + item.children().length() + ")";
}
return item.@label + suffix;
}
private function swfTeacher_complete(evt:Event):void {
panel.status = (swfTeacher.bytesTotal/1024).toFixed(2) + 'KB';
}
]]>
</mx:Script>
If anybody has any ideas how to do this I'd be ecstatic to hear it!
warm wishes
Stacey
http://www.instaspanish.com/images/sample.jpg
Here is the code I'm using to load the SWFLoaders in the Flex app:
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function tree_itemClick(evt:ListEvent):void {
var t:Tree = evt.currentTarget as Tree;
var dataObj:Object = evt.itemRenderer.data;
if (dataObj.hasOwnProperty("@mainswf")) {
swfLoader.source = dataObj.@mainswf;
} else if (t.dataDescriptor.isBranch(t.selectedItem)) {
swfLoader.source = null;
panel.status = "";
}
}
private function tree_labelFunc(item:Object):String {
var suffix:String = "";
if (tree.dataDescriptor.isBranch(item)) {
suffix = " (" + item.children().length() + ")";
}
return item.@label + suffix;
}
private function swfLoader_complete(evt:Event):void {
panel.status = (swfLoader.bytesTotal/1024).toFixed(2) + 'KB';
}
]]>
</mx:Script>
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function tree_itemClick2(evt:ListEvent):void {
var t:Tree = evt.currentTarget as Tree;
var dataObj:Object = evt.itemRenderer.data;
if (dataObj.hasOwnProperty("@tutorswf")) {
swfTeacher.source = dataObj.@tutorswf;
} else if (t.dataDescriptor.isBranch(t.selectedItem)) {
swfTeacher.source = null;
panel.status = "";
}
}
private function tree_labelFunc2(item:Object):String {
var suffix:String = "";
if (tree.dataDescriptor.isBranch(item)) {
suffix = " (" + item.children().length() + ")";
}
return item.@label + suffix;
}
private function swfTeacher_complete(evt:Event):void {
panel.status = (swfTeacher.bytesTotal/1024).toFixed(2) + 'KB';
}
]]>
</mx:Script>
If anybody has any ideas how to do this I'd be ecstatic to hear it!
warm wishes
Stacey