PDA

View Full Version : Navigation path


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........

rrh
10-14-2010, 05:57 PM
For you to click on a movieclip, it has to mean it's in the display list, which means the stage should be accessible.

EightySeven
10-15-2010, 08:39 PM
Could you please us the <as> tags for your code? It very hard to read unformatted

//Look I'm a code block
var i:int = array.length-1;

eivindt
10-16-2010, 03:44 AM
Hi!
Sorry for a possibly stupid inquiry.... If this is very simple I would appreciate if somebody could enlighten me.....:-)

Trying to use the trace function to display a list of user -visited menu -elements in a flash menu. Instead of the output window I want my dynamic menu - labels to show in 1 multiline Dynamic textfield I have created on stage.
So my question is, does anyone now how to redirect the tracing of dynamic button clicks to stage? My button for the menu is a Movieclip, in which I have the code for tracing the name of each visited Array element in the Menu.
Here is my code for the Dynamic menu(This is placed on layer Menu actions in frame 1 in the main timeline:

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, there is the code for the movieclip symbol actions timeline:

import flash.events.MouseEvent;
import flash.display.Stage;
import flash.text.TextField;
var buttonTrace:TextField;
var labelName:String;
var targetClip:MovieClip;
clickButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void {
trace(labelName);
targetClip.gotoAndStop(labelName)
buttonTrace.appendText("\n" + labelName);
}


And finally, I will put the code from one frame of the manual subMenus I have made, because here is an example of the TextField display actually working:

arkview.addEventListener(MouseEvent.ClickToGoToAnd PlayFromFrame_5);

function f1_ClickToGoToAndPlayFromFrame_5(event:MouseEvent) :void
{
trace("arkview");
buttonTrace.appendText("\n" + "arkview");
gotoAndPlay(18);
}


- buttonTrace here being my single dynamic textField on the stage.

I am simply wondering what I have to do to make the "labelName" from the Array - menu output in the "buttonTrace" onstage as the frame buttons do....

eivindt
10-17-2010, 11:43 PM
Problem solved.....
I added the reference to the main timeline in addition to the buttonTrace, like this:

clickButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void {
trace(labelName);
targetClip.gotoAndStop(labelName);
MovieClip(root).buttonTrace.appendText("\n" + labelName)
}

..... Just for anybody interested....