eivindt
10-14-2010, 02:25 AM
Hello!
Trying to use the trace function to display a navigated user path in part of a flash menu. Instead of the output window I want my dynamic menu labels to show in the Dynamic textfield I have created on stage. This works fine with the timeline buttons I use, but not with the dynamically assigned ones.....
because there are no instances on stage..... So my question is, does anyone now how to redirect the tracing of dynamic button clicks to stage? I have tried doing this in the timeline for the movieclip symbol used as dynamic menu button, but I am not an expert at this....
Here is my code for the Dynamic menu:
var sectionNames:Array = new Array("Frontpage","Intro",
"Designparadigm", "Tooling", "Maya & c++ API", "Geometric Vectors","Lindenmayer systems","Artificial Life",
"Projects","Litterature","Disclaimer","Site credits","Newsletter & Rss",
"Blogging","Plugins","Links");
var sectionCount: int = sectionNames.length;
var menu:Sprite = new Sprite();
menu.x = 452;
menu.y = 172;
this.addChild(menu);
buildMenu();
function buildMenu():void {
for(var i:int=0; i < sectionCount ; i++){
var item:MovieClip = new MenuItem();
item.labelName = sectionNames[i];
item.targetClip = this;
if(i<4){
item.y = i*125
menu.addChild(item)}
else if (i>3 && i<8){
item.y = (i-4)*125
item.x = 125
menu.addChild(item)}
else if (i>7 && i<12){
item.y = (i-8)*125
item.x = 250;
menu.addChild(item)}
else if (i>11 && i<16){
item.y = (i-12)*125
item.x = 375
menu.addChild(item)}
}
}
In addition, I have the code for the movieclip symbol actions timeline:
import flash.display.MovieClip;
import flash.events.MouseEvent;
//TextField labelField;
//SimpleButton clickButton;
var labelName:String;
var targetClip:MovieClip;
clickButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void {
trace(labelName);
targetClip.gotoAndStop(labelName);
}
And finally, If I want to display trace() for my manually assigned buttons in a dynamic TextField I have made on stage, I just apply something like:
arkview.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_5);
function fl_ClickToGoToAndPlayFromFrame_5(event:MouseEvent) :void
{
trace("Architectural Viewpoint");
buttonTrace.appendText("\n" + "Architectural Viewpoint");
gotoAndPlay(18);
}
buttonTrace here being my dynamic textField.
Hope anyone can help........
Trying to use the trace function to display a navigated user path in part of a flash menu. Instead of the output window I want my dynamic menu labels to show in the Dynamic textfield I have created on stage. This works fine with the timeline buttons I use, but not with the dynamically assigned ones.....
because there are no instances on stage..... So my question is, does anyone now how to redirect the tracing of dynamic button clicks to stage? I have tried doing this in the timeline for the movieclip symbol used as dynamic menu button, but I am not an expert at this....
Here is my code for the Dynamic menu:
var sectionNames:Array = new Array("Frontpage","Intro",
"Designparadigm", "Tooling", "Maya & c++ API", "Geometric Vectors","Lindenmayer systems","Artificial Life",
"Projects","Litterature","Disclaimer","Site credits","Newsletter & Rss",
"Blogging","Plugins","Links");
var sectionCount: int = sectionNames.length;
var menu:Sprite = new Sprite();
menu.x = 452;
menu.y = 172;
this.addChild(menu);
buildMenu();
function buildMenu():void {
for(var i:int=0; i < sectionCount ; i++){
var item:MovieClip = new MenuItem();
item.labelName = sectionNames[i];
item.targetClip = this;
if(i<4){
item.y = i*125
menu.addChild(item)}
else if (i>3 && i<8){
item.y = (i-4)*125
item.x = 125
menu.addChild(item)}
else if (i>7 && i<12){
item.y = (i-8)*125
item.x = 250;
menu.addChild(item)}
else if (i>11 && i<16){
item.y = (i-12)*125
item.x = 375
menu.addChild(item)}
}
}
In addition, I have the code for the movieclip symbol actions timeline:
import flash.display.MovieClip;
import flash.events.MouseEvent;
//TextField labelField;
//SimpleButton clickButton;
var labelName:String;
var targetClip:MovieClip;
clickButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void {
trace(labelName);
targetClip.gotoAndStop(labelName);
}
And finally, If I want to display trace() for my manually assigned buttons in a dynamic TextField I have made on stage, I just apply something like:
arkview.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_5);
function fl_ClickToGoToAndPlayFromFrame_5(event:MouseEvent) :void
{
trace("Architectural Viewpoint");
buttonTrace.appendText("\n" + "Architectural Viewpoint");
gotoAndPlay(18);
}
buttonTrace here being my dynamic textField.
Hope anyone can help........