To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 02-28-2006, 08:41 PM   #1
MrToaster
Junior Member
 
Join Date: Feb 2006
Posts: 1
Adding action to XML Menu

Hello,

I was wondering if anybody would be kind enough to assist me with my actionscript problems. I have acquired a component XML Menu from a site and a tutorial on preloading and transitioning dynamic files. The problem that I am having is that I have no idea on how to link these two items. On the tutorial page, they tell me to make an actions layer and add the following code:

code:
b1.onRelease = function() {
if (_root.section != "profile.swf") {
_root.section = "profile.swf";
_root.transition.gotoAndPlay("closing");
}
};
b2.onRelease = function() {
if (_root.section != "gallery.swf") {
_root.section = "gallery.swf";
_root.transition.gotoAndPlay("closing");
}
};
b3.onRelease = function() {
if (_root.section != "photos.swf") {
_root.section = "photos.swf";
_root.transition.gotoAndPlay("closing");
}
};



That code obviusly is for the basic buttons on the tutorial but I what I need is for the tutorial's loading and transitioning to be triggered by the XML Menu.

Here is the code for the XML menu (theres more but I believe this is the only relevant part):

code:
//--------------------------------------------------
#initclip 1
CollapseButtonClass = ProtoLinkClass();
CollapseButtonClass.inheritFrom(MovieClip);
Object.registerClass("CollapseButton", CollapseButtonClass);
CollapseButtonClass.prototype.init = function() {
if (!this.alpha) {
this.alpha = {start:0, top:100, bottom:0};
}
this.yinactive = this._y;
this.y = this.yinactive;
this.bgObjParams = {width:this.parent._width_, height:this.parent._height_, colourthis.butType == 'secondary') ? (this.parent.sColour) : (this.parent.pColour), alpha:this.alpha.top, resize:false, applyColour:true};
this.txtObjParams = {x:1, y:1, w:this.parent._width_ - 20, h:this.parent._height_ - 0, applyBground:false, applyFocus:true, title:String(this._name), applyIndentthis.butType == 'secondary') ? (true) : (false)};
this.id = this.attachMovie("Rectangle", "bg", 1, this.bgObjParams);
this.id = this.attachMovie("TextBox", "txt", 2, this.txtObjParams);
this.active = false;
this.enabled = true;
};
CollapseButtonClass.prototype.onSignal = function() {
if (this.enabled) {
if (!this.active) {
this.butType == 'secondary' ? this.bg.setColour(this.parent.sColour) : this.bg.setColour(this.parent.pColour);
var newOpacity = Mouse.isWithin(this, true) ? this.alpha.top : this.alpha.bottom;
this.bg._alpha = Math.approach(this.bg._alpha, newOpacity);
} else {
this.bg.setColour(this.parent.aColour);
}
if (this._y <> this.y) {
this._y = Math.approach(this._y, this.y);
}
}
};
CollapseButtonClass.prototype.onMouseUp = function() {
if (Mouse.isWithin(this, true)) {
this.parent.sID.playSound(this.butType);
if (this.butType == 'primary') {
this.parent.activateObj(this.uid);
if (this.butAction != null) {
trace("Action specified in XML: " + this.butAction);
}
} else if (this.butType == 'secondary') {
trace("Action specified in XML: " + this.butAction);
}
}
};
#endinitclip
//==================================================



I am not sure if it will be helpful but, here is the sample XML file:

Quote:
<menu>

<item name="Menu1" action="loadClip">

</item>

<item name="Menu2" action="loadClip">

<sub name="SubMenu1" action="loadClip"></sub>

<sub name="SubMenu2" action="loadClip"></sub>

</item>

<item name="Menu3" action="loadClip">

<sub name="SubMenu3" action="loadClip"></sub>

<sub name="SubMenu4" action="loadClip"></sub>

<sub name="SubMenu5" action="loadClip"></sub>

<sub name="SubMenu6" action="loadClip"></sub>

<sub name="SubMenu7" action="loadClip"></sub>

</item>

<item name="Menu4" action="loadClip">

<sub name="SubMenu8" action="loadClip"></sub>

<sub name="SubMenu9" action="loadClip"></sub>

</item>

<item name="Menu5" action="loadClip">

</item>

<item name="Menu6" action="loadClip">

</item>

</menu>
Thanks in advance to anybody willing to help.
MrToaster is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:38 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.