all groups > macromedia flash sitedesign > january 2006 >
You're in the

macromedia flash sitedesign

group:

_global.currentPage....



Re: _global.currentPage.... David Stiller
1/27/2006 2:14:42 PM
macromedia flash sitedesign: jonnie1988,

[quoted text, click to view]

Do you mean unique HTML pages that contain SWFs, or are all these
"pages" represented inside a single SWF?

[quoted text, click to view]

The term "sub-page" isn't clear to me. I *think* I know what you mean,
but there isn't any official term "sub-page" ... so, well, what *do* you
mean? :)

[quoted text, click to view]

I'm with you.

[quoted text, click to view]

So you created an arbitrary currentPage property of the _global object,
sometimes called a "global variable"; I'm still with you.

[quoted text, click to view]

You haven't explained what this _global.currentPage is for yet -- how is
it used?

[quoted text, click to view]

Unless you *get* the value of this _global property, it isn't really
being used for anything. You can set it to whatever value you like, but
unless you check its value from time to time, what good is it? Of course,
you may very well be doing this ... if so, please explain what you're doing,
and show the ActionScript you've written to do it.

[quoted text, click to view]

Without knowing any more detail, I'd say go ahead and change the way
your ActionScript is set up. ;)

[quoted text, click to view]

Sure. _global.currentPage1 and _global.currentPage2 -- or, make that
_global property an array ...

var myCurrentPages = new Array();
myCurrentPages[0] = "uno";
myCurrentPages[1] = "uno";
myCurrentPages[2] = "uno";

_global.currentPages = myCurrentPages;


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

_global.currentPage.... jonnie1988
1/27/2006 2:17:06 PM
Hey again.. I'm back with yet another problem!

My website has a "news" page, a "profile" page, an "audio" page, a "visual"
page, and a "contact" page.

My "profile" page has 3 sub-pages, being "history", "albums", and "band
members".

When I click to open the profile page from the news page, an animation plays
to get rid of the news page, and another animation plays to enter the profile
page. Now the _global.currentPage is equal to "profile", and the mini "history"
page is displayed. In order for certain animations to play when I want them to,
doesn't this "history" page also have to be the currentPage?

When I click band members, an animation plays to get rid of the history page,
and another animation plays to introduce the band members page, and the
_global.currentPage is set to "band members", instead of "history" or "profile".

This means that I can't now click on any of "news", "profile", "audio",
"visual" or "contact", because my actionscript is only set up to play the
certain entry and exit animations if the _global.currentPage is set to one of
those 5 pages. Is there a way that you can have TWO currentPages?

Or is there another script for mini-pages?

Thanks in advance
Re: _global.currentPage.... jonnie1988
1/28/2006 1:14:20 PM
Thanks for replying, although I think I've found a way of getting round it now..

I made the pages that are WITHIN the "profile" page in a new flash document,
and then I'm going to import it to my other one, so that all 3 pages are within
the _global.currentPage = "profile"; but each page within the seperate flash
file has a different _global.currentPage.

When I open the seperate flash document, there's 4 layers, an actions layer, a
"history" layer for the history page, a "band members" layer for the band
members page, and an "albums" layer for the albums page.

The action script I have in scene 1 is this:

_global.currentPage = "history";
_root.history_mc.historyInvisible_btn.enabled = false;

and nothing else. This makes the currentPage "history" and stops the history
button from working, so the user knows they're on the history page.

When I go into my "history_mc" movie clip in the history layer, there is this
actionscript:

// on roll over event \\

_root.history_mc.historyInvisible_btn.onRollOver = function(){
_root.history_mc.historyAnim_mc.gotoAndPlay("start");
}

// end roll over event \\

// on release event \\

_root.history_mc.historyInvisible_btn.onRelease = function(){
switch (currentPage) {
case "history" :
break;
case "bandMembers" :
_root.history_mc.gotoAndPlay("start");
_root.bandMembers_mc.gotoAndPlay("end");
_root.bandMembers_mc.bandMembers_btn.enabled = true;
break;
case "albums" :
_root.history_mc.gotoAndPlay("start");
_root.albums_mc.gotoAndPlay("end");
_root.albums_mc.albumsInvisible_btn.enabled = true;
break;
}
_global.currentPage = "history";
_root.history_mc.historyInvisible_btn.enabled = false;
}

// end on release event \\

the on roll over event is what happens when you mouse over the history
button.. it plays an animation, and it works fine.
The on release event is what happens when you click the history button. If
you're on the history page, it doesn't do anything, if you're on the band
members page, it should play the animation to make the history page dissapear,
and the band members page appear. For some reason this doesn't work. I've
labeled the frame where the history animation starts "start" and the frame
where it ends "end", and the same for the band members movie clip page.

Why could it be that when the button is pressed the animation doesn't play
even though it should?

The "band members" page plays in, but the "history" page doesn't play out for
some reason.. and the "band members" button also doesn't get disabled when it
should.

Thanks
Re: _global.currentPage.... David Stiller
1/30/2006 9:35:29 AM
jonnie1988,

[quoted text, click to view]

You keep using the word "page," and Flash just doesn't have pages, so
I'm afraid I can't be sure what you mean.

[quoted text, click to view]

Okay.

[quoted text, click to view]

Actually, the on press event is what happens when you click a button.
The on release event is what happens when you let go, after having clicked.

[quoted text, click to view]

In this code here ...



I've
[quoted text, click to view]

Re: _global.currentPage.... David Stiller
1/30/2006 9:41:55 AM
Sorry! Itchy trigger finger. Here's the rest of what I meant to write.

[quoted text, click to view]

_root.history_mc.historyInvisible_btn.onRelease = function() {
switch (currentPage) {
// etc.

.... you're checking for the value of currentPage. But look where you're
checking it *from*. Your reference point is within historyInvisible_btn,
which is nested within history_mc. True, you make currentPage global, but
depending on your circumstances, you might have to preceed that currentPage
variable with the _global object reference. I haven't tested your code, of
course, and this may be just fine, but you'll know for sure if you see the
data you're dealing with. Use trace() to trouble shoot ...

_root.history_mc.historyInvisible_btn.onRelease = function() {
trace(currentPage);
switch (currentPage) {
// etc.

If you see undefined in the Output panel, you'll know that ActionScript
doesn't "see" currentPage from this vantage point.

_root.history_mc.historyInvisible_btn.onRelease = function() {
trace(_global.currentPage);
switch (_global.currentPage) {
// etc.

The _global prefix might make the difference.

If that's not it, then you'll have to continue troubleshooting. Often,
it *seems* obvious what your various variables' values are, but actuality
turns out to be different. Have you used the Debugger panel yet? It's a
great tool. Run your SWF by selecting Debug Movie, rather than Test Movie,
and you'll see a mechanism for looking at your variables and objects on the
fly. (When you Debug, you'll have to hit the green triangle arrow to start
.... you'll see what I mean.)

Shed some light on what your SWF actually looks like "under the hood."


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

AddThis Social Bookmark Button