Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Cascading Functions From Events



HI, I have a big doubt about loaders:

When loading video, pictures or XML data, an event is dispatched when the load process is finished, then a function is called to do whatever I want to do with the loaded data.

So all subsequent instructions must be inside the called function. In if I need more data loads, I find myself diving into nested functions, and I dont like it.

Is there any other approach for these things?

Regards: Miguel



KirupaForum > Flash > ActionScript 3.0
Posted on: 01-26-2008, 02:11 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Functions And Events
When I type object_mc.onPress = myFunction(param1, param2); on the 1st frame in the Actions layer and test it, the function is called instantaneously and never assigned to the onPress event.
How can I assign a function with parameters to an event?

Static Functions And Events
This is a potentially idiotic question, but it's bothered me before and so I thought I should ask...

I was just trying to build out a pretty simple project using static methods and variables. When it came time to attach events to various things in the movie, I discovered I had no way of tracking down which movie clip fired the event because, of course, "this" is not a valid member of a static object.

So, for example, say you have two buttons called mc_myButton1 and mc_myButton2. In frame 1 of the movie, you you call
Code:
MyClass.main(this);
And your class file looks like this:
Code:
class MyClass {
public static function main(mc_target) {
trace(mc_target);
mc_target.mc_myButton1.onRelease = sayHi;
mc_target.mc_myButton2.onRelease = sayHi;
}
}

public static function sayHi() {
trace("the movie clip " + this + " asked me to do something");
}
}
.... you get an error saying:
Quote:




'this' is not accessible from this scope.




You can avoid this by throwing in an anonymous function like this:

Code:
mc_target.mc_myButton1.onRelease = functiion() {
trace("the movie clip " + this + " asked me to do something");
}
...but I personally hate nesting anonymous methods inside methods like this because it makes it difficult to follow the code visually.

So, my question is: is there any way of capturing events attached to movie clips by static functions without using anonymous methods? I feel silly asking this since the easiest solution is to avoid using static methods altogether when you know you are going to need to attach events, but I'm curious if there is a better answer than that.

Duplicate Functions/events?
I am using the following code from a user here a few minutes ago for a button that shows a hidden layer when a button is moused over...


ActionScript Code:
this.navbtn.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);

function rollOverHandler(Event:MouseEvent):void
{
this.labels.alpha = 1;
}

this.navbtn.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);

function rollOutHandler(Event:MouseEvent):void
{
this.labels.alpha = 0;
}

When I try to duplicate this code and simply change the button and layer names it says that I can't duplicate the function? What's going on?

Do I need to make each function/event a named event... if so, how?

Add Functions To OnEnterFrame Events..
hi,
is this possible to add things to do in onEnterFrame events ??
for exemple i have two function:

function movex() {
t++;
this._x = Math.cos(t/10)*100;
}
function movey() {
t++;
this._y = Math.cos(t/10)*100;
}

what i want to do is call the function on a MC:

myMC.onEnterFrame = movex

and later, add the other function to the onEnterFrame event without killing the first one...

see what i mean ?

Passing Parameters To Functions From Events
I've read several posts that talk about this. I apologize for creating a new one but my brain requires a category for storing information before i can commit that information to memory. Staring at working coded solutions does not teach me why I'm writing the code.

I do not come from an application development background. I started out as a fine artist and got real good at solving as1/2 problems creatively.... I'm bashing my head against the wall trying to understand all the "improvements" in as3.

I'd like to make this as simple as possible. In my head I say, "I want to trace out a different word depending on what button i press" then i say, "ok, well im going to need some buttons, and they are going to call a function and pass the word they are supposed to say"


Code:
//oldschool
btn1.onRelease = function(){
sayWord("hello")
}
btn2.onRelease = function(){
sayWord("world")
}
function sayWord(theWord){
trace(theWord);
}
Wow that was super simple. the logic directly correlates to the code i just wrote.

What are the questions I have to ask myself in order to know what is involved in making the same thing in as3?

Thanks guys,
Rada

Can Someone Explain This? Re Button Events And Functions...
function rollover(xpos:Number,ypos:Number):Void{
trace("("+xpos+" , "+ypos+")");
}
function grow(){
this._xscale+=5;
}
function shrink(){
this._xscale-=5;
}
var btnx:Array=new Array(100,200,300,400,500);
var btny:Array=new Array(100,100,100,100,100);
for(i=0;i<5;i++){
_root.attachMovie("myBTN","my_btn"+i,_root.getNextHighestDepth());
_root["my_btn"+i]._x=btnx[i];
_root["my_btn"+i]._y=btny[i];
//trace(btnx[i]);
_root["my_btn"+i].onRollOver=rollover(btnx[i],btny[i]);
_root["my_btn"+i].onRollOver=grow;
_root["my_btn"+i].onRollOut=shrink;
}

i was just doing this as a test to try and find something out, but i cant fiqure out why the rollover function seems to get executed at runtime immediately so this script spews the numbers out in the output panel straight away, but on a rollover nothing happens so i cant understand why it executes the function but not when it is actually called?? and the other two functions grow and shrink work fine unless i decide that i want to pass a variable/parameter to those functions and then the same anomolie occurs, i am guessing it is to do with variable scope and functions and or mouse event handlers.... on movie clips. can anyone shed some light on this

NetStream & Button Events Or Functions
So I had the pleasure of learning all about video in the fantastic tutorials on the site. However, I've run into a bit of a snag. First, here's what I'm trying to do.

I have a flash movie for a film, when a user clicks on a characters image it takes that person to a frame for that character where they have the option of watching a short clip with that character. Rather than automatically loading the external .flv I want to give the user the option of deciding wether to load & play the clip by clicking a button.

Here's the issue I've run into. I have found that when netSteam is associated with an onRelease event or function that there seem to be issues with loading external .flvs, especially when there is a load bar or or other advanced functions associated with it. The code obviously works perfectly when it's not within a function. Not sure why this happens.

I have found somewhat of a workaround by having the movie move forward one frame after an onRelease button event and placing the code in the next frame. While this is all great and achieves my objective, the **** German in me can't seem to let go of the fact that it should still work when associated with a button event. Any insight or explanations would be greatly appreciated and allow me to sleep peacefully at night, instead of dreaming about action script all night. Thanks,

Max

Multiple OnPress() Functions/events For Same Clip?
I'm trying to add an onPress() function to several movieclips, which simply sets a boolean to "false" if the user clicks anything within them.

The problem is that many of the clips already have their own onPress() event handlers defined, and adding my own event handler seems to overwrite them, not add to them. My initial thought was an event listener, but apparently movieclips don't broadcast this event.

These movie clips were written by somebody else and some are loaded dynamically, so I don't have the option to add my functionality to each one... it needs to happen dynamically. Besides, adding my code to each object would violate OOP, a big no-no.


Any suggestions? Alternatives?

ActionScript 2.0 - MovieClip Events As Class Functions
Hi

I was wondering if you code help me out with Actionscript 2.0 and classes.

I have built a movie which has some nested movies within. I have created a class called ButtonMc in a .as file and used linkage to connect the symbol in the .FLA file with the class code in the ButtonMc.as file . This is the code for ButtonMc class:


Code:
class ButtonMc extends MovieClip
{
//stores the MovieClip Instance which will be assigned to this class
private var mcButton:MovieClip;

/* Constructor - takes in the movieclip*/
public function ButtonMc(mcInstance:MovieClip, mcInstanceName:String, mcInstanceDepth:Number, xPos:Number, yPos:Number)
{
//mcInstance will hold value "this"- which will mean a connectionwill be made
//between this objects (when created) movieclip property and the symbol in the .fla.
mcButton = mcInstance.attachMovie("ButtonMc", mcInstanceName, mcInstanceDepth);
//set the initial position of movie on stage
setPosition(xPos, yPos);
//dont display the handcursor for this movie clip
mcButton.useHandCursor = false;
//starts the onrollover event
}

/* Sets/Changes the position of the movie clip on stage*/
public function setPosition(x:Number, y:Number)
{
mcButton._x = x;
mcButton._y = y;
}

/* when mouse rolls over */
public function onRollOver()
{
mcButton.gotoAndPlay("over");
}

}
Then on my _root(main timeline) i have a action to create an instance of the the class and display the movie. I have this action:


Code:
var mc:ButtonMc = new ButtonMc(this, "mcunderstand", 0, 10, 50);
This movieclip displays when run, but nothing happens when i rollover the movieclip, it does not work and does not go to and play the specified frame for the "over" state.

Am i doing this wrong? I thought that all code related to an object would go inside the class and be ready to use?

Any help on this would be great

Thanks alot.

AS3 - Class Events And Timeline Defined Functions
I'm just wondering, i got used to this in AS2

I make a class


ActionScript Code:
class User
{
    public function User (uid:Number)
    {
        var h = this;
        var xml:XML = new XML ();
        xml.onLoad = function (s)
        {
            if (s)
            {
                h.onReadConfig ();
            }
        };
        xml.load ('somephp.php?id=' + uid);
    }
    public function onReadConfig ()
    {
        // empty function
    }
}


then i do something like this on the timeline code so i could customize every event.


ActionScript Code:
var u:User = new User(20);
u.onReadConfig = function(){
    some_mc.gotoAndPlay('animate');
}


for some reason, if i try to modify the method of the User class, it returns a
1168: Illegal assignment to function onReadConfig. error.

So i was wondering if there were any simple but effective way of listening to the "onReadConfig" event function so that my timeline code would just wait for my user object to finish reading the xml and do whatever it wants.

But if you have any other alternatives on this, i am open to suggestions :-)

Cascading Menu
I am trying to find any resources so that I can develop a menu structure that will automatically move the main sections down so that the subsections may be clicked upon, but if you roll off the menu collapses.

If I had a text version visually it would first look like

Menu 1
Menu 2
Menu 3
Menu 4

When you rolled over Menu 1 the menu would look like this

Menu 1
Submenu 1
Submenu 2
Submenu 3
Menu 2
Menu 3
Menu 4

If you rolled over Menu 2 you would see

Menu 1
Menu 2
Submenu 1
Submenu 2
Submenu 3
Menu 3
Menu 4


Is there a tutorial that will show me how to develop this WITHOUT making frame labels and making animations and having them gotoAndPlay("Menu_1animation")? I have seen it before, I just dont know where I can find a tutorial on how to build my own. Does anyone have any source information and/or tutorials they know of for me to be able to develop this?

Cascading Menu - Please Help :)
Hello ... help please help .... this is driving me nuts !!

Problem - Basically I want to customizing a cascading menu but when I add or remove sub menu's from this file it seems to mess everything up..

Examples:

File one is the original from flash kit - which I have being trying to customize unsuccessfully.
Menu Collapse MX.fla.zip

File two shows the menu working if i have the same number of sub menus in each menu
menu-1.fla.zip

File three shows the menu all messed up when I try to add or remove a sub menu.
menu-2.fla.zip

I'm obviously missing something fundamental in this but I just can't work it out !

any advice would be really appreciated I'm lost with this!

Cheers in advance

rormac

Cascading Menu?
I downloaded this script for a cascading menu and it works great but I need to know the code for my links to work.

The Code:

// Variables -----------------------------------------------------------------------
// Height of Mainmenu items
var homm = 20;
// Height of Submenu items
var hosm = 15;
// mm_array contains the main menu, sm#_array contains the sub menu items for menu #
var mm_array:Array = ["Some Menu", "Second Menu", "Third Menu", "Fourth Menu", "Fifth Menu", "Created by Mav"];
var sm1_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4"];
var sm2_array:Array = ["Submenu 1", "Submenu 2"];
var sm3_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var sm4_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 2", "Submenu 3", "Submenu 4"];
var sm5_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var sm6_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var submenu_array:Array = [];
// Functions ------------------------------------------------------------------------
_global.$tweenManager.broadcastEvents = true;
// Main menu
function createMainMenu() {
var a = 1;
var total = mm_array.length;
while (a<=total) {
ypos = ((a-1)*homm)+1;
attachMovie("mainnav_mc", "mainnav"+a+"_mc", this.getNextHighestDepth()+100, {_x:0, _y:ypos});// attach the movieClip
var nc = this["mainnav"+a+"_mc"];
nc.menutext = mm_array[(a-1)];// set the title text for each button
nc.itemnum = a;// set the menu #
a++;
}
}
function moveMenu(num) {
if ((_root.collapsed == true) || (_root.selectedmenu != num)) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var totalmm = mm_array.length;
var a = 1;
while (a<=totalmm) {
mc = this["mainnav"+a+"_mc"];
if (a>num) {
var ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
mc.tween("_y", ypos, 0.5, "easeOutCubic");
} else {
var ypos = ((a-1)*homm)+1;
if (a == num) {
nypos = ypos;
mc.tween("_y", ypos, 0.5, "easeOutCubic", 0, onEnd(num, nypos));
} else {
mc.tween("_y", ypos, 0.5, "easeOutCubic");
}
}
a++;
}
_root.collapsed = false;
} else {
contractMenu()
_root.collapsed = true;
}
}
function onEnd(num, nypos) {
_root.num = num;
createSubMenu(num, nypos);
}
function contractMenu() {
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
var g = 1;
while (g<=mm_array.length) {
ypos = ((g-1)*homm)+1;
this["mainnav"+g+"_mc"].tween("_y", ypos, 0.5, "easeOutCubic");
g++;
}
}
function createSubMenu(num, nypos) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var ypos = nypos+4;
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
submenu_array = [];
var a = 1;
while (a<=totalsm) {
ypos = ypos+hosm+1;
attachMovie("subnav_mc", "subnav"+a+"_mc", a+30, {_x:0, _y:ypos});
if (num != mm_array.length) {
attachMovie("mask_mc", "mask"+a+"_mc", a+990, {_x:0, _y:0});
mask_mc = this["mask"+a+"_mc"];
mask_mc._alpha = 10;
mask_mc.onEnterFrame = function() {
this._height = _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
};
this["subnav"+a+"_mc"].setMask(mask_mc);
}
nc = this["subnav"+a+"_mc"];
nc._alpha = 0;
nc.itemnum = a;
nc.menutext = eval(array)[(a-1)];
nc.alphaTo(100, 2);
nc.onRelease = function() {
// Function to get submenu actions needs to go here
var my_str:String = new String(this);
_root.select = "You have selected "+my_str.slice(18);
};
submenu_array.push("subnav"+a+"_mc");
a++;
}
}
// Build Menu -----------------------------------------------------------------------
_root.collapsed = true;
createMainMenu();


So with this how can I add a loadMovieNum. or OnRelease function on the submenus to load other .swf clips on another level?

Thanks
Brad

Cascading Combo Box Help
Hi,
I was wondering if anyone could help me with cascading combo boxes. I've looked around everywhere and haven't been able to find much about them for flash. I have an xml file with a list of subjects. Each subject has its correlating set of multiple choice questions. I can get the first combo box to load the different subjects but wat I need now is for the second combo box to load the multiple choice questions based on the subject selected.
Any help would be greatly appreciated! Thanx!

Cascading Menu Help
Hi. This is from a movie I got over at Flashkit, but these forums are simply more helpful, so here goes. I'm trying to add functions to each 'submenu' to load external swfs, but can't figure it out. What exactly are the instance names of the submenu buttons, so I could just call "submenu1.onRelease = function"....etc? It says to put the button functions in the nc.onRelease function, but I just don't know what to put.

Here's the link to the movie file:

http://www.flashkit.com/movies/Inter...1370/index.php

And the corresponding AS:



Code:
// Variables -----------------------------------------------------------------------
// Height of Mainmenu items
var homm = 20;
// Height of Submenu items
var hosm = 15;
// mm_array contains the main menu, sm#_array contains the sub menu items for menu #
var mm_array:Array = ["Printed Publications", "Web & Multimedia", "3D", "Exhibitions", "Maps & Plans", "Illustrations"];
var sm1_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4"];
var sm2_array:Array = ["Submenu 1"];
var sm3_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var sm4_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 2", "Submenu 3", "Submenu 4"];
var sm5_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var sm6_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var submenu_array:Array = [];
// Functions ------------------------------------------------------------------------
_global.$tweenManager.broadcastEvents = true;
// Main menu
function createMainMenu() {
var a = 1;
var total = mm_array.length;
while (a<=total) {
ypos = ((a-1)*homm)+1;
attachMovie("mainnav_mc", "mainnav"+a+"_mc", this.getNextHighestDepth()+100, {_x:0, _y:ypos}); // attach the movieClip
var nc = this["mainnav"+a+"_mc"];
nc.menutext = mm_array[(a-1)]; // set the title text for each button
nc.itemnum = a; // set the menu #
a++;
}
}
function moveMenu(num) {
if ((_root.collapsed == true) || (_root.selectedmenu != num)) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var totalmm = mm_array.length;
var a = 1;
while (a<=totalmm) {
mc = this["mainnav"+a+"_mc"];
if (a>num) {
var ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
mc.tween("_y", ypos, 0.5, "easeOutCubic");
} else {
var ypos = ((a-1)*homm)+1;
if (a == num) {
nypos = ypos;
mc.tween("_y", ypos, 0.5, "easeOutCubic", 0, onEnd(num, nypos));
} else {
mc.tween("_y", ypos, 0.5, "easeOutCubic");
}
}
a++;
}
_root.collapsed = false;
} else {
contractMenu()
_root.collapsed = true;
}
}
function onEnd(num, nypos) {
_root.num = num;
createSubMenu(num, nypos);
}
function contractMenu() {
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
var g = 1;
while (g<=mm_array.length) {
ypos = ((g-1)*homm)+1;
this["mainnav"+g+"_mc"].tween("_y", ypos, 0.5, "easeOutCubic");
g++;
}
}
function createSubMenu(num, nypos) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var ypos = nypos+4;
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
submenu_array = [];
var a = 1;
while (a<=totalsm) {
ypos = ypos+hosm+1;
attachMovie("subnav_mc", "subnav"+a+"_mc", a+30, {_x:0, _y:ypos});
if (num != mm_array.length) {
attachMovie("mask_mc", "mask"+a+"_mc", a+990, {_x:0, _y:0});
mask_mc = this["mask"+a+"_mc"];
mask_mc._alpha = 10;
mask_mc.onEnterFrame = function() {
this._height = _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
};
this["subnav"+a+"_mc"].setMask(mask_mc);
}
nc = this["subnav"+a+"_mc"];
nc._alpha = 0;
nc.itemnum = a;
nc.menutext = eval(array)[(a-1)];
nc.alphaTo(100, 2);
trace ("main"+num+"_"+a+"sub.swf");
nc.onRelease = function() {// Function to get submenu actions needs to go here
var my_str:String = new String(this);
//_root.select = my_str.slice(18);
};
submenu_array.push("subnav"+a+"_mc");
a++;
}
}
// Build Menu -----------------------------------------------------------------------
_root.collapsed = true;
createMainMenu();

Cascading Style Sheets
I need a quick way to learn and apply this knowledge of cascading style sheets, can anyone give me a link for a wizard of this topic!

Thank You!

What Do I Do With A Css (cascading Style Sheet)
I have been working on my website and one day, in my email, I got an email concerning my website. Along with that email was a .css for my website. I have no idea what it is and what to do with it. and I feel like a stupid person by asking him about it. I mean he already took the trouble of making a css I cant ask more of him. So what is a css and what do I do with it and also how to do you make them? thanks in advance

Cascading Menu From A Database
Is there a fla out there that creates a cascading rollover menu similar to the one at http://www.microsoft.com's homw page?

I need to create a menu like that, that is build from a database query (perhaps with XML).

It must support an unlimited number of submenus!

Cascading Menu Problems
Hi all,

I'm trying to get a cascading menu working, but right now it's giving me headache. (see attachment)

What I've done:
- button with tellTarget that makes a movie play which contains the
submenu buttons on mouseover
- same button with tellTarget that tells the movie to hide the buttons on rollout/click.

on (rollOver) {
tellTarget ("sub1") {
gotoAndPlay (2);
}
tellTarget ("submenu_egotrip") {
gotoAndPlay (2);
}
}
on (release, rollOut) {
tellTarget ("sub1") {
gotoAndPlay (12);
}
tellTarget ("submenu_egotrip") {
gotoAndStop (8);
}
}
on (press) {
getURL ("egotrip.php", "content");
}


It works, the problem is when I go over the submenu buttons it fools around. Probably this has to do with the fact that the 2 buttons are on top of the main button?

Anyhow - any tips, solutions for this would be warmly appreciated.
Thanks,

step

ps. see attachment

Cascading Menu Problems
Hi all,

I'm trying to get a cascading menu working, but right now it's giving me headache. (see attachment)

What I've done:
- button with tellTarget that makes a movie play which contains the
submenu buttons on mouseover
- same button with tellTarget that tells the movie to hide the buttons on rollout/click.

on (rollOver) {
tellTarget ("sub1") {
gotoAndPlay (2);
}
tellTarget ("submenu_egotrip") {
gotoAndPlay (2);
}
}
on (release, rollOut) {
tellTarget ("sub1") {
gotoAndPlay (12);
}
tellTarget ("submenu_egotrip") {
gotoAndStop (8);
}
}
on (press) {
getURL ("egotrip.php", "content");
}


It works, the problem is when I go over the submenu buttons it fools around. Probably this has to do with the fact that the 2 buttons are on top of the main button?

Anyhow - any tips, solutions for this would be warmly appreciated.
Thanks,

step

ps. see attachment

Dynamic Cascading Menu
Can someone tell me how to make one of these menus in flash? When you hover over a button, you get a whole new menu with subcategories?An example is at wdc.com and sony.com. THANKS!!

Cascading Style Sheets
If a file is saved in flash mx.
Can you open it with mx 2004 Pro and use css files in it, then save it?

My Cascading Menu Colapse When I Get URL ? WHY?
Hey there

I have created a vertical cascading menu.
You can see it here:
http://www.vogelius.dk/albertslund/forebyggende.htm

If you press the topic "behandlinger" then it opens the menu and there is three sub topics "forbyggende", "bevarende" and "erstattende".
when i press...lets say "bevarende" i have made an:
_____________________
on(press, release){
getURL("http://www.vogelius.dk/albertslund/bevarende.htm");
}
_____________________
The flash file is made to stay open...but when i get the html, then the menu is back to start...

HOW DO I GET FLASH TO STAY OPEN, even when it changes the HTML ???
What code do i need to put in with the GET URL???

Please help...i'm on a deadline here :-)

THANKS
So MUCH

Jimmy
Mirrorman

[F8] Cascading Menu Trouble
i'm trying to use this - link to create a menu structure. I've managed to customise the look and the menu names, but I need the links to load various swf files.

here's the code


Code:
// Variables -----------------------------------------------------------------------
// Height of Mainmenu items
var homm = 20;
// Height of Submenu items
var hosm = 15;
// mm_array contains the main menu, sm#_array contains the sub menu items for menu #
var mm_array:Array = ["Printed Publications", "Web & Multimedia", "3D", "Exhibitions", "Maps & Plans", "Illustrations"];
var sm1_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4"];
var sm2_array:Array = ["Submenu 1"];
var sm3_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var sm4_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 2", "Submenu 3", "Submenu 4"];
var sm5_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var sm6_array:Array = ["Submenu 1", "Submenu 2", "Submenu 3", "Submenu 4", "Submenu 5"];
var submenu_array:Array = [];
// Functions ------------------------------------------------------------------------
_global.$tweenManager.broadcastEvents = true;
// Main menu
function createMainMenu() {
var a = 1;
var total = mm_array.length;
while (a<=total) {
ypos = ((a-1)*homm)+1;
attachMovie("mainnav_mc", "mainnav"+a+"_mc", this.getNextHighestDepth()+100, {_x:0, _y:ypos});// attach the movieClip
var nc = this["mainnav"+a+"_mc"];
nc.menutext = mm_array[(a-1)];// set the title text for each button
nc.itemnum = a;// set the menu #
a++;
}
}
function moveMenu(num) {
if ((_root.collapsed == true) || (_root.selectedmenu != num)) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var totalmm = mm_array.length;
var a = 1;
while (a<=totalmm) {
mc = this["mainnav"+a+"_mc"];
if (a>num) {
var ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
mc.tween("_y", ypos, 0.5, "easeOutCubic");
} else {
var ypos = ((a-1)*homm)+1;
if (a == num) {
nypos = ypos;
mc.tween("_y", ypos, 0.5, "easeOutCubic", 0, onEnd(num, nypos));
} else {
mc.tween("_y", ypos, 0.5, "easeOutCubic");
}
}
a++;
}
_root.collapsed = false;
} else {
contractMenu()
_root.collapsed = true;
}
}
function onEnd(num, nypos) {
_root.num = num;
createSubMenu(num, nypos);
}
function contractMenu() {
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
var g = 1;
while (g<=mm_array.length) {
ypos = ((g-1)*homm)+1;
this["mainnav"+g+"_mc"].tween("_y", ypos, 0.5, "easeOutCubic");
g++;
}
}
function createSubMenu(num, nypos) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var ypos = nypos+4;
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
submenu_array = [];
var a = 1;
while (a<=totalsm) {
ypos = ypos+hosm+1;
attachMovie("subnav_mc", "subnav"+a+"_mc", a+30, {_x:0, _y:ypos});
if (num != mm_array.length) {
attachMovie("mask_mc", "mask"+a+"_mc", a+990, {_x:0, _y:0});
mask_mc = this["mask"+a+"_mc"];
mask_mc._alpha = 10;
mask_mc.onEnterFrame = function() {
this._height = _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
};
this["subnav"+a+"_mc"].setMask(mask_mc);
}
nc = this["subnav"+a+"_mc"];
nc._alpha = 0;
nc.itemnum = a;
nc.menutext = eval(array)[(a-1)];
nc.alphaTo(100, 2);
trace ("main"+num+"_"+a+"sub.swf");
nc.onRelease = function() {// Function to get submenu actions needs to go here
var my_str:String = new String(this);

//_root.select = my_str.slice(18);
};
submenu_array.push("subnav"+a+"_mc");
a++;
}
}
// Build Menu -----------------------------------------------------------------------
_root.collapsed = true;
createMainMenu();

I'm tried putting
trace ("main"+num+"_"+[(a-1)]+".swf");
in the onRelease function at the end of the code, but it just returns the main menu number and the total number of sub menu items rather than the individual submenu number. if you put the trace function in before the onRelease command it returns all the submenu names...

i'm seriously confused, any help would be really appreciated!

Cascading Drop-down Menu. Help Please
Hi all Small problem, just wondering if anyone could help.

I am trying to create a new menu system for a website using flash 8. (see attached)

The premise is that when the user rolls over one section in the menu, a small drop down area appears revealing the relevant subsections for that section underneath. Fairly standard really.

So I've set up all the animations for each section (so each section has a 'drop down' animation and a 'fold away' animation) but the problem I am having is getting the sections to animation as and when the users would want them to.

I am having conflicts when the user is rolling over one section before the previous section has had time to 'fold away'. Its hard to explain but if you download the file you will see what I mean right away. I just need to somehow say to all the animations "don’t do anything until the other animation has stopped".

I’ve tried adding a if statement to say if "animating" is true then wait until "animating" is false, but no joy .

I’m contemplating starting from scratch with another concept but i figured id ask u guys before all hope was lost

Any help is greatly appreciated. Thanks

Customising Cascading Menu
Hi Everyone

I have modified the Simon Coulton Cascading Menu. Everything works fine, but I would like certain subnavigations to appear open when certain pages load. I would like to do this by sending a variable to flash form where the flash file is embedded in html. I have done this many times before, but do not know how to modify this script to initiate the submenu based on this variable.

Any help appreciated.

I have attached the original zip and my edited .fla

-----------------------------------------------------------------------

// Variables -----------------------------------------------------------------------
// Height of Mainmenu items
var homm = 30;
// Height of Submenu items
var hosm = 22;
// mm_array contains the main menu, sm#_array contains the sub menu items for menu #
var mm_array:Array = ["HOMEPAGE", "THE RESORT", "PURCHASE OPTIONS", "WHY MAURITIUS?", "GALLERY", "DOWNLOADS", "NEWS", "GETTING THERE", "SALES ENQUIRIES"];
var sm1_array:Array = [];
var sm2_array:Array = ["OVERVIEW", "FACILITIES", "ARCHITECTURAL DESIGN", "FAQ'S", "THE DEVELOPERS", "PROFESSIONAL TEAM"];
var sm3_array:Array = ["VILLAS", "APARTMENTS", "HOTEL"];
var sm4_array:Array = ["THE ISLAND", "INVESTMENT OPPORTUNITY"];
var sm5_array:Array = ["PHOTO GALLERY", "PROGRESS GALLERY"];
var sm6_array:Array = [];
var sm7_array:Array = ["MEDIA COVERAGE", "EMAIL NEWSLETTER", "MEDIA IMAGE LIBRARY"];
var sm8_array:Array = [];
var sm9_array:Array = [];
var submenu_array:Array = [];
// Functions ------------------------------------------------------------------------
_global.$tweenManager.broadcastEvents = true;
// Main menu
function createMainMenu() {
var a = 1;
var total = mm_array.length;
while (a<=total) {
ypos = ((a-1)*homm)+1;
attachMovie("tester", "tester", 990, {_x:0, _y:291});
attachMovie("mainnav_mc", "mainnav"+a+"_mc", this.getNextHighestDepth()+100, {_x:0, _y:ypos});// attach the movieClip
var nc = this["mainnav"+a+"_mc"];
nc.menutext = mm_array[(a-1)];// set the title text for each button
nc.itemnum = a;// set the menu #
a++;
}
}
function moveMenu(num) {
if ((_root.collapsed == true) || (_root.selectedmenu != num)) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var totalmm = mm_array.length;
var a = 1;
while (a<=totalmm) {

mc = this["mainnav"+a+"_mc"];

if (a>num) {
var ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
mc.tween("_y", ypos, 0.5, "easeOutCubic");
tester.tween("_y", ypos + 50, 0.5, "easeOutCubic");
} else {
var ypos = ((a-1)*homm)+1;
if (a == num) {
nypos = ypos;
mc.tween("_y", ypos, 0.5, "easeOutCubic", 0, onEnd(num, nypos));
tester.tween("_y", ypos + 50, 0.5, "easeOutCubic", 0, onEnd(num, nypos));
} else {
mc.tween("_y", ypos, 0.5, "easeOutCubic");
tester.tween("_y", ypos + 50, 0.5, "easeOutCubic");
}
}
a++;
}
_root.collapsed = false;
} else {
contractMenu()
_root.collapsed = true;
}

// Function to get main menu actions needs to go here
if (array == "sm1_array"){
getURL("/","_self","get");
trace ("Goto 1");
}
else if (array == "sm6_array"){
getURL("/downloads","_self","get");
trace ("Goto 6");
}
else if (array == "sm8_array"){
getURL("/getting-there","_self","get");
trace ("Goto 8");
}
else if (array == "sm9_array"){
getURL("/sales","_self","get");
trace ("Goto 9");
}

}
function onEnd(num, nypos) {
_root.num = num;
createSubMenu(num, nypos);
}
function contractMenu() {
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
var g = 1;
while (g<=mm_array.length) {
ypos = ((g-1)*homm)+1;
this["mainnav"+g+"_mc"].tween("_y", ypos, 0.5, "easeOutCubic");
tester.tween("_y", ypos + 50, 0.5, "easeOutCubic");
g++;
}
}
function createSubMenu(num, nypos) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var ypos = nypos+4;
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
submenu_array = [];
var a = 1;
while (a<=totalsm) {
ypos = ypos+hosm+1;
attachMovie("subnav_mc", "subnav"+a+"_mc", a+30, {_x:0, _y:ypos});
if (num != mm_array.length) {
attachMovie("mask_mc", "mask"+a+"_mc", a+990, {_x:-100, _y:0});
mask_mc = this["mask"+a+"_mc"];
mask_mc._alpha = 10;
mask_mc.onEnterFrame = function() {
this._height = _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
};
this["subnav"+a+"_mc"].setMask(mask_mc);
}
nc = this["subnav"+a+"_mc"];
nc._alpha = 0;
nc.itemnum = a;
nc.menutext = eval(array)[(a-1)];
nc.alphaTo(100, 2);
nc.onRelease = function() {
// Function to get submenu actions needs to go here
var my_str:String = new String(this);

trace ("Main Item:" + _root.num);
trace ("Sub Item:" + my_str.slice(27));

// Resort Dropdown
if (_root.num == 2){
if (my_str == "_level0.container_mc.subnav1_mc"){
getURL("/overview","_self","get");
trace ("Goto 1");
}
if (my_str == "_level0.container_mc.subnav2_mc"){
getURL("/facilities","_self","get");
trace ("Goto 2");
}
if (my_str == "_level0.container_mc.subnav3_mc"){
getURL("/architectural-design","_self","get");
trace ("Goto 3");
}
if (my_str == "_level0.container_mc.subnav4_mc"){
getURL("/faqs","_self","get");
trace ("Goto 4");
}
if (my_str == "_level0.container_mc.subnav5_mc"){
getURL("/developers","_self","get");
trace ("Goto 5");
}
if (my_str == "_level0.container_mc.subnav6_mc"){
getURL("/professional-team","_self","get");
trace ("Goto 6");
}
}

// Purchase Options Dropdown
if (_root.num == 3){
if (my_str == "_level0.container_mc.subnav1_mc"){
getURL("/villas","_self","get");
trace ("Goto 1");
}
if (my_str == "_level0.container_mc.subnav2_mc"){
getURL("/apartments","_self","get");
trace ("Goto 2");
}
if (my_str == "_level0.container_mc.subnav3_mc"){
getURL("/hotel","_self","get");
trace ("Goto 3");
}
}

// Why Mauritius Dropdown
if (_root.num == 4){
if (my_str == "_level0.container_mc.subnav1_mc"){
getURL("/why-mauritius","_self","get");
trace ("Goto 1");
}
if (my_str == "_level0.container_mc.subnav2_mc"){
getURL("/investment-opportunity","_self","get");
trace ("Goto 2");
}
}

// Gallery Dropdown
if (_root.num == 5){
if (my_str == "_level0.container_mc.subnav1_mc"){
getURL("/gallery","_self","get");
trace ("Goto 1");
}
if (my_str == "_level0.container_mc.subnav2_mc"){
getURL("/progress-gallery","_self","get");
trace ("Goto 2");
}
}

// News Dropdown
if (_root.num == 7){
if (my_str == "_level0.container_mc.subnav1_mc"){
getURL("/news","_self","get");
trace ("Goto 1");
}
if (my_str == "_level0.container_mc.subnav2_mc"){
getURL("/news-letter","_self","get");
trace ("Goto 2");
}
if (my_str == "_level0.container_mc.subnav3_mc"){
getURL("/media-image-library","_self","get");
trace ("Goto 3");
}
}

};
submenu_array.push("subnav"+a+"_mc");
a++;
}
}
// Build Menu -----------------------------------------------------------------------
_root.collapsed = true;
createMainMenu();

1st Post - Cascading Menu
Hi, I am new here, as well as new to advance as. I urgently need help as I am stuck with this part of the project.

I've downloaded a source file from flashkit.com, and I intend to use it. unfortunately my limited knowledge hinders me.

Is it possible that I use loadMovie func instead of attachMovie function, how do I add it in that case, I want to loadMovie to an Instant on the stage. if loadMovie is not possible where do I put the mc?

Thanks a bunch

How To Make This Cascading Menu?
hi, I am a newbie to flash, I want to know how can i use flash to create the cascading menu like this http://www.iforce.co.uk

Cascading Menu Driven By XML
Okay I have the menu that hga77 built but I want to add a few attributes to it. Everytime I add the attributes I get more buttons for somereason or another and the function does not work like it should. Hga77's script is easy to follow but difficult to moddify.

I want to add something like the following to his menu so I can set everything up in the XML file.

vt.menuObj["item"+j].what = menu_xml.firstChild.childNode[i].attributes.what;
vt.menuObj["item"+j].where = menu_xml.firstChild.childNodes{i].attributes.where;
vt.menuObj["item"+j].the_type = menu_xml.firstChild.childNodes[i].attributes.type;

and then be able to have either the main buttons or the sub buttons do the following function:

onRelease = function() {
if (this.the_type != undefined) {
if ((this.the_type == "geturl") or (this.the_type == "getURL")) {
unloadMovie(_root.dropZone);
getURL(this.what, this.where);
}
if ((this.the_type == "gotoAndPlay") or (this.the_type == "gotoandplay")) {
unloadMovie(_root.dropZone);
tellTarget (this.where) {
gotoAndPlay(this.what);
}
}
if ((this.the_type == "gotoAndStop") or (this.the_type == "gotoandstop")) {
unloadMovie(_root.dropZone);
tellTarget (this.where) {
gotoAndStop(this.what);
}
}
if ((this.the_type == "loadMovie") or (this.the_type == "loadmovie")) {
loadMovie(this.what, this.where);
}
if ((this.the_type == "attachMovie") or (this.the_type == "attachmovie")) {
tellTarget (this.where) {
attachMovie(this.what, this.what+i, i);
}
}
if ((this.the_type == "fsCommand") or (this.the_type == "fscommand")) {
unloadMovie(_root.dropZone);
fscommand(this.what, this.where);
}
if ((this.the_type == "function") or (this.the_type == "Function")) {
unloadMovie(_root.dropZone);
eval(this.where)[this.what]();
}
}
};

McTween: Cascading Tweens
I want to fade a series of pictures one after the other, such that they'll loop around. I'm calling this a cascade.

So to do this, i've placed all of the image names into an array and I set all of their alpha properties to 100 to begin with. I think I then need a for loop that will iterate through the images, fading the image down to 0, waiting for a set period of time and then moving on.

Unfortunately, mcTween will fade all of the images at once in the for loop, so I need to prevent a tween from starting until the one before it has finished. I thought I could achieve this using a while loop and the isTweening property, but when I try and preview the flash movie it just gets into a recurring loop and the program hangs, and has to be exited.

What is the correct way to do this?


Code:
#include "mc_tween2.as"

var countInterval;
var images:Array = new Array();
images = [wine_mc, sunset_mc, poppies_mc, pool_mc, eastView_mc]

wine_mc._alpha = 100;
eastView_mc._alpha = 100;
pool_mc._alpha = 100;
sunset_mc._alpha = 100;
poppies_mc._alpha = 100;

for(var i = 0; i < images.length; i++){
_root[images[i]].alphaTo(0,1,"linear")
while(_root[images[i]].isTweening()) {
//do nothing
}
}
I haven't gotten around to pausing between tweens, but I believe I used setInterval to pause execution before. I seem to remember someone telling me that this isn't the best way to pause execution anymore. Can anyone clarify this?

many thanks!
Daf

ContextMenu Cascading/Sub Menus
In the default context menu, there's the quality adjustment settings with a sub menu for the low, medium, high.

I know how to manipulate the menu at the top level just fine (so don't worry about having to explain how to use the ContextMenu classes), I'm just wondering if it's possible to create sub-menus like that quality one. I searched through the archives, couldn't find anything useful to this end, so thanks to anyone who has thoughts or can point me to an existing tutorial on submenus.

Thanks!

Cascading (drop-down) Menus
Is it possible to create cascading or drop-down menus in flash?  I would see a great deal of variance that could be employed if this is the case.

Controlling A Cascading Menu Externally
i have a dynamic three-level cascading menu that my client needs to be able to control externally (from within Authorware), (perhaps using something like ExpandMenuTo(*,*,*), he says)... the problem is, the menu is built using the data contained in an external file with this AS:
:::::::::::::::::::::::::::
on (release) {
tellTarget ("/prev") {
gotoAndStop(1);
}
// This is the part where we load the .swf or whatever
loadMovieNum (url, 10);
getURL(url, 10, "post");
// ----------------------------!!!!--------------------------
/:wo = pos;
/:next = eval("/os" add Number(pos+1));
/rev = eval("/os" add Number(pos-1));
/:titel = t_name;
/:header = /:titel;
i = 0;
// set all titels inactive
while (Number(i)<Number(../:t_anz)) {
i = i+1;
tellTarget ("../:" add i) {
gotoAndStop("normal");
}
z = 0;
// set all chapters inactive
while (Number(z)<Number(eval("../:k_anz_t" add i))) {
z = z+1;
tellTarget ("../:" add i add "-" add z) {
gotoAndStop("normal");
}
g = 0;
// set all sub-chapters inactive
while (Number(g)<Number(eval("../:u_k_anz_t" add i add "_k" add z))) {
g = g+1;
tellTarget ("../:" add i add "-" add z add "-" add g) {
gotoAndStop("normal");
}
// get rid of the sub-chapters...
setProperty(i add "-" add z add "-" add g, _visible, 0);
}
}
}
// infos 4 positioning
/:active2 = "";
/:active = _name;
tellTarget ("/") {
gotoAndPlay(6);
}
// last but not least... set this button active
gotoAndStop("active");
}
:::::::::::::::::::::::::::::
there is, of course, more code elsewhere...

i sure could use someone's help in getting these different levels controlled from outside... anyone?

thanks,
glenn

Cascading Menu, Buttons Move To Top
I am looking into creating a menu that has a list of options and when you click and of the options in the list, the one you click moves to the top of the list and the others items make way.

e.g.

bread
cheese
bacon
eggs


click bacon

list then reads as

bacon
bread
cheese
eggs

they will be animated



any ideas or relevant movies, tuts to looks at.

Thanks

ds

Dynamic Cascading Menu Problem
Hi,

i was looking at an example of a dynamic cascading menu. Its being created by the use of arrays. Now what i dont get is, how to tell the actionscript to start a certain mc when you select a submenu.


Code:
var homm = 20;
var hosm = 15;

var mm_array:Array = ["Biografie", "Recensies", "Contacteer", "Gallerij"];
var sm1_array:Array = ["Studies", "Curriculum Vitae"];
var sm2_array:Array = ["Recensies"];
var sm3_array:Array = ["Adres", "Email", "Webmaster"];
var sm4_array:Array = ["Sculpturen", "Schilderijen"];
var submenu_array:Array = [];

_global.$tweenManager.broadcastEvents = true;

function createMainMenu() {
var a = 1;
var total = mm_array.length;
while (a<=total) {
ypos = ((a-1)*homm)+1;
attachMovie("mainnav_mc", "mainnav"+a+"_mc", this.getNextHighestDepth()+100, {_x:0, _y:ypos});
var nc = this["mainnav"+a+"_mc"];
nc.menutext = mm_array[(a-1)];
nc.itemnum = a;
a++;
}
}
function moveMenu(num) {
if ((_root.collapsed == true) || (_root.selectedmenu != num)) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var totalmm = mm_array.length;
var a = 1;
while (a<=totalmm) {
mc = this["mainnav"+a+"_mc"];
if (a>num) {
var ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
mc.tween("_y", ypos, 0.5, "easeOutCubic");
} else {
var ypos = ((a-1)*homm)+1;
if (a == num) {
nypos = ypos;
mc.tween("_y", ypos, 0.5, "easeOutCubic", 0, onEnd(num, nypos));
} else {
mc.tween("_y", ypos, 0.5, "easeOutCubic");
}
}
a++;
}
_root.collapsed = false;
} else {
contractMenu()
_root.collapsed = true;
}
}
function onEnd(num, nypos) {
_root.num = num;
createSubMenu(num, nypos);
}
function contractMenu() {
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
var g = 1;
while (g<=mm_array.length) {
ypos = ((g-1)*homm)+1;
this["mainnav"+g+"_mc"].tween("_y", ypos, 0.5, "easeOutCubic");
g++;
}
}
function createSubMenu(num, nypos) {
var array = "sm"+num+"_array";
var totalsm = eval(array).length;
var ypos = nypos+4;
var c = 1;
while (c<=submenu_array.length) {
removeMovieClip("subnav"+c+"_mc");
removeMovieClip("mask"+c+"_mc");
c++;
}
submenu_array = [];
var a = 1;
while (a<=totalsm) {
ypos = ypos+hosm+1;
attachMovie("subnav_mc", "subnav"+a+"_mc", a+30, {_x:0, _y:ypos});
if (num != mm_array.length) {
attachMovie("mask_mc", "mask"+a+"_mc", a+990, {_x:0, _y:0});
mask_mc = this["mask"+a+"_mc"];
mask_mc._alpha = 10;
mask_mc.onEnterFrame = function() {
this._height = _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
};
this["subnav"+a+"_mc"].setMask(mask_mc);
}
nc = this["subnav"+a+"_mc"];
nc._alpha = 0;
nc.itemnum = a;
nc.menutext = eval(array)[(a-1)];
nc.alphaTo(100,2);
nc.onRelease = function() {
var my_str:String = new String(this);
_root.select = my_str.slice(18);

};
submenu_array.push("subnav"+a+"_mc");
a++;
}
}

_root.collapsed = true;
createMainMenu();
Any help would be appreciated, as i am not familiar with this type of workflow.

Kind regards,
Ariff

Cascading Style Sheets In Flash?
How do you load XML text file that also uses CSS file?

Thanks,
Kevin

Controlling A Cascading Menu Externally
i have a cascading menu that expands to a number of tiers depending on the variables in an external txt file - my client needs to be able to control the flow of the menu externally, if possible (from within Authorware...)...

is there a way to control a Movie externally?

thanks
glenn

Cascading Style Sheets Scrollbar Size
Hello. I was wondering if you can set the size of the scrollbar using Cascading Style Sheets. If so, does anyone know the code for it? Thanks in advance, Leo.

LF Cascading/Drop Menu Tutorial For MX 2004
I have yet to find a tutorial on how to create a cascading menu like the one featured here for Flash MX 2004. I need to have the bottom buttons move down when buttons above them are clicked and the submenus appear...hope that makes sense.

Any suggestions or words of encouragement?

Thanks!

Load Movies - Cascading Window System
Hey guys,

I am building a site, and for each page I am using a draggable window.

Each window is in a seperate swf file, so the need to be loaded.

I am going to have the windows cascading so you have to close them to get rid of them.

However i thought it would be nice so when you clicked the tab of a window, which is hidden beneath any other windows that are open, it pops up to the front, just like microsoft windows really.

I was just wondering how i would do this, i thought about loading the swf's into levels, and thought maybe there was a script which could swap levels or something.


Any ideas or a link to an oline tutorial?

any help would be great.

Thanks in advance.

Simon

LF Cascading/Drop Menu Tutorial For MX 2004
I have yet to find a tutorial on how to create a cascading menu like the one featured here for Flash MX 2004. I need to have the bottom buttons move down when buttons above them are clicked and the submenus appear...hope that makes sense.

Any suggestions or words of encouragement?
Maybe I'm using the wrong term for the style of menu...

Thanks!

Load Movies - Cascading Window System
Hey guys,

I am building a site, and for each page I am using a draggable window.

Each window is in a seperate swf file, so the need to be loaded.

I am going to have the windows cascading so you have to close them to get rid of them.

However i thought it would be nice so when you clicked the tab of a window, which is hidden beneath any other windows that are open, it pops up to the front, just like microsoft windows really.

I was just wondering how i would do this, i thought about loading the swf's into levels, and thought maybe there was a script which could swap levels or something.


Any ideas or a link to an oline tutorial?

any help would be great.

Thanks in advance.

Simon

Register Classes - Mc Events Vs Button Events
I'm experimenting with register classes today, and wasn't careful typing the code with only button events for my custom movie clip class.
First I wrote

Code:
CustomClass.prototype.onMouseDown = function(){
this.gotoAndStop("blue");
}// end onMouseDown
Then all the mc-buttons in my movie went to the blue state. (.fla provided)
When I realised the error, I corrected it, and now it works.
I just don't understand what happened.
Do Movie Clip events turn out to be class methods (don't know what to call it in Java script, only used to Java), while button events stay instance events??
Hope somebody have the time - it's not about life and death, but it would be really nice to know how these things work.

Made Functions Using For Loop, Trace Returns Undefined When Running Functions?
ActionScript Code:
var navAreas:Array = new Array("LOL", "WOOT", "ROFL");for (var f:Number = 0; f < navAreas.length; f++) {    this["action" + f] = function () {        trace(navAreas[f]);    };        // should make functions action0, action1, action2.}action1(); // shou'd return WOOT, but returns undefined.  

"cascading" Text Smaller To Larger
Hi
I am trying to design animation that "cascades" numbers from 0-9 (smaller to bigger) on a mouse roll over and then the reverse on mouse roll out. Know what I mean?
Can any one direct me to a tutorial please? I have searched this site but nothing seems relevant to what I am trying to do>
PLEASE!
Thanks

Dynamic Functions - Creating Functions At Runtime Without So Many Ifs/elses...
Hi, nice to register after lurking for a while and seeing how smart people are on here......

I am writing some code that needs to be very efficient, yet flexible. This is in a class and when the class gets initialized a function is setup. I want this function to run straight through without doing any time-consuming things such as calling other functions or routines, or doing any if/else logic/branching.

Now I know that you can setup a function at anytime during runtime such as:


Code:
var myFunction:Function = function() {trace('HELLO!')}
But what I am trying to do is to try and append code to a function based on logic, yet I don't want the function to be deciding this logic when it is running as it will only need deciding when the function is created.... imagine if it were a string it would be something like myFunction+="do somethingelse;" which would be the same as having initially setup myFunction as such:


Code:
var myFunction = function() {do something; do somethingelse;}
With this I seem to be having no luck

Here's an example where I setup the most compact/efficient function at runtime depending on what I want the function to do. Now this was fairly simple because when we create the function there are only a few possible variations, but I need someway of doing a function+= as my real code has quite a few variations and it would be a nightmare have a zillion if/else branches. REMEMBER I do not want any logic/decisions in the function itself as it to be the most efficient the function must be as compact as possible and run straight-through.


Code:
var dynamicFunction:Function;
//
// Setup the dynamic function & call it
// In this example outputs "Hello Jim" & "Goodbye Jim"
dynamicFunction = CrapSetupRoutine(true, true, "Jim");
dynamicFunction();
//
// Try and setup the dynamic function using a less ify/elsey (less complicated) routine & call it
// In this example it doesn't work if we try and make it say both Hello & Goodbye like above :(
dynamicFunction = SetupRoutineIWouldLike(true, true, "Jim");
dynamicFunction();
//
function CrapSetupRoutine(sayHello:Boolean, sayGoodbye:Boolean, yourName:String):Function {
var returnFunction:Function;
// Far too many ifs/elses...but remember the function created cannot have any if/else logic or calls to other functions
if (!sayHello and !sayGoodbye) {
returnFunction = function () {
trace("<dynamicFunction> sits bored");
};
} else if (sayHello and sayGoodbye) {
returnFunction = function () {
trace("Hello "+yourName);
trace("Goodbye "+yourName);
};
} else {
if (sayHello) {
returnFunction = function () {
trace("Hello "+yourName);
};
} else {
returnFunction = function () {
trace("Goodbye "+yourName);
};
}
}
return returnFunction;
}
//
//What I actually want the Setup function to resemble is this
function SetupRoutineIWouldLike(sayHello:Boolean, sayGoodbye:Boolean, yourName:String):Function {
var returnFunction:Function;
// the ifs/elses are as minimal as possible, which is good
if (!sayHello and !sayGoodbye) {
returnFunction = function () {
trace("<dynamicFunction> sits bored");
};
} else {
if (sayHello) {
returnFunction = function () {
trace("Hello "+yourName);
};
}
if (sayGoodbye) {
// the += below doesn't work.....so the question is how to append to it?????
returnFunction += function () {
trace("Goodbye "+yourName);
};
}
}
return returnFunction;
}
// The end
P.S. I knew the += would never work as this is a function and not a string. But at least if you think of the function as a string you'll get what I'm trying to do.....I suspect if it can be done it involves casting or something and maybe using strings initially??

Respond To Mouse Events Inside A Movieclip That Has Mouse Events...
I have a main MC that has a couple of mouse events associated with it (onPress mainly). There are also MC's inside this main MC that have Mouse events associated to them (onPress, onMouseMove, onRelease). The child MCs don't seem to get the mouse events (which makes sense, the parent is taking over the event)...how can I make this work? I don't want to have to delete and recreate the event handlers like 900 times as its not efficient...there has to be a better way.

Multiple Functions Or Long Functions With For.. Statements?
Which is better? A long function with a couple of for... statements, or multiple functions with only one for... statement in it?

Andy

Copyright © 2005-08 www.BigResource.com, All rights reserved