Web Design Forum: [FLASH 8] Buttons in external SWF's loading content - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[FLASH 8] Buttons in external SWF's loading content Rate Topic: -----

#1 User is offline   krillin 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 23
  • Joined: 30-July 08
  • Reputation: 0
  • Experience:Intermediate
  • Area of Expertise:Designer

Posted 04 August 2008 - 06:50 PM

Hi all, now i just followed this tutorial on intro and exit animations and found it very helpful, but i have come across a problem and am hoping for a little help from one of you actionscript geniuses if at all possible.

I would like the buttons that navigate the site to be in the same external SWF's so i can animate them as well, the problem is i can't seem to get the actionscript to work, here's what mine looks like:

container.button01.onPress = function() {
	if (_root.currMovie == undefined) {
	_root.currMovie = "home";
	_root.container.loadMovie("home.swf");
		} else if (_root.currMovie != "home") {
		if (container._currentframe >= container.midframe) {
	_root.currMovie = "home";
	container.play();
	}
	}
}

And i've also tried using

this._lockroot = true;


in the external SWFs but that didn't work either :( I'm completely lost, does anyone have see where i'm going wrong?

Cheers.
0

#2 User is offline   Roberto 

  • Rain Dog
  • PipPipPipPip
  • Group: Members
  • Posts: 532
  • Joined: 19-August 07
  • Reputation: 2
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 04 August 2008 - 07:36 PM

Hello

You could just animate the buttons in the containing swf - using container.button01.gotoAndPlay(frameNumber); to control the animation of the button, when it is clicked on + use gotoAndStop(frameNumber) or stop(); within that movieclip/button to stop the movieclip/button from looping the animation + to stop at the right frame.

Rob
0

#3 User is offline   krillin 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 23
  • Joined: 30-July 08
  • Reputation: 0
  • Experience:Intermediate
  • Area of Expertise:Designer

Posted 05 August 2008 - 02:43 PM

Cheers for the reply, but i figured it out after reading this and having a long drawn out battle with actionscript! :D

If anyones interested, or has the same problem and stumbles across this thread he's what i did:

The stage holds a empty MC called "container" thats about it.

On each of the dynamically loaded SWFs the actionscript for their buttons looks like this:

stop();
this._lockroot = true;

button1.onPress = function() {
	if (_level0.currMovie == undefined) {
	_level0.currMovie = "home";
	_level0.container.loadMovie("home.swf");
		} else if (_level0.currMovie != "home") {
		if (_level0.container._currentframe >= _level0.container.midframe) {
	_level0.currMovie = "home";
	_level0.container.play();
	}
	}
}

button2.onPress = function() {
	if (_level0.currMovie == undefined) {
	_level0.currMovie = "art";..... yadda yadda yadda, you get the idea


The problem was i was using _root when i should of been using _level0, once i tried that it all fell into place :D

Get in you beauty! Back of the net!! I figured it out, me! thats a hell of an achievement for someone whose an artist and not a coder, but i am going to start doing my homework on actionscript now, i thought i had a good grasp on it, but i really don't, still, i'm glad i was able to sort this out myself, it's given me a real buzz :D

Peace!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users