PDA

View Full Version : Button embedded in movie clip trouble


mikekarkowski
06-26-2002, 11:19 PM
I am trying to set up a links page, with flash buttons that link to other web pages.

I can get it to work (just a getUrl command) but I cannot get it the getUrl to work when the button is embedded in another movie clip.

I'm guessing its a problem with my paths, but I've tried everything and cannot figure it out.

If I have a button embedded in a movie clip, how do I get the button to load an new page or link?

(If you could email me a suggestion, it would help.)


Thanks in advance.

mike@benvenutiandstein.com

ps: you can visit the site I'm working on at www.benvenutiandstein.com.

CyanBlue
06-27-2002, 01:18 AM
I think the code should be the same whether it is inside of the movieclip or not... Show us what you have... :)

mkarkowski@eart
06-28-2002, 04:42 PM
The button I'm using is nested into another movie clip.
I simply tried to use:

on (release) {
getURL ("http://www.benvenutiandstein.com", "_blank");
}

I want to create a links page with links to other sites.

This works when on a separate page, not nested within another movie, but when nested it doesn't work.

Thanks.

CyanBlue
06-28-2002, 05:27 PM
Um... I'd say there is something else that's affecting that button script... Can you put trace("Hello"); within that on (release) block and see if you are getting that 'Hello' message???
Well, with the given information, that's the only thing I can think of... Sorry no help here... You might want to create a sample FLA and show us...

Filipinho
06-28-2002, 05:47 PM
You can also do it with a JavaScript together with Flash. Some of the advantages is that you can choose if you want to show the menu, the navigation buttons, set the siz of the window and a couple of other things. If you want to do it with JavaScript like I said, write this within the <head> tag of the html site that the flash file is embedded in:

<script language="JavaScript">
<!--
function openWindow(URL) {
window.open(URL,'The name you want','toolbar=no,location=no,status=no,menubar=no ,scrollbars=no,resizable=no,width=160,height=160, top=0')
}
//-->
</script>

you can set the atributes to wathever you want.

On the button in Flash you write this:
on (release){
getURL ("JavaScript:openWindow('the_url_you_want.html');");
}

If you want to set the window atributes from flash write this instead:
<script language="JavaScript">
<!--
function openWindow(URL, Name, features) {
window.open(URL, Name, features)
}
//-->
</script>

And on the button:
on (release){
getURL ("JavaScript:openWindow('the_url_you_want.html', 'The name you want','toolbar=no,location=no,status=no,menubar=no ,scrollbars=no,resizable=no,width=160,height=160, top=0' );");
}

But like CyanBlue said. It might be some other problems with the button...

tubedogg
06-29-2002, 04:00 PM
I'm having almost this exact problem, though my issue is getting it to jump to another scene.

My code is:
on (release) {
gotoAndStop("EditInput",1);
}
and it's the same as mikekarkowski said - it acts like a link but it doesn't go anywhere when clicked. Outside the movie clip, the same button & code works just fine.

I tried that trace("Hello"); bit and Hello never shows up.

Any other ideas? :)

tubedogg
06-29-2002, 04:08 PM
Here's a test FLA...

Filipinho
06-29-2002, 04:10 PM
JavaScript()OpenWindow should be JavaScript ( ) OpenWindow without the blanks.

You canīt go to next scene from a movieclip using that code. You have to be in the timeline.

Instead give the first frame in the scen you want to jump to a frame name (like scene 2). Then you write:
on (release){
_root.gotoAndStop("scene 2")
}

It works!

tubedogg
06-29-2002, 04:23 PM
It worked, thanks! :)

mkarkowski@eart
07-01-2002, 10:34 PM
Okay, I wanted to post a sample *.swf file for you to look at, but I didn't want to post the entire site I was working on, so I created a small movie with a few buttons, one directly on the main timeline, one nested within another movie and still another nested twice. I used the same action script (the simple getURL) that I was having trouble with before. I tested the movie, and it worked!

So I went into the site I'm developing, and verified that the code is the same, one works and one didn't. So what gives?

I created a new movie and re-built the problem page from scratch, and everything was working fine. I created a button, and copied it several times to create more buttons for the various links, and then it seemed to stop. I came to the conclusion that when I copy and paste MORE THAN ONE BUTTON at a time, the buttons just wouldn't work. If I CTRL+C and CTRL+V one button at a time, edit the target URL, no problem. But more than one at a time is when I noticed problems.

I am still confused. I got it to work, but don't know why it didn't before. Anybody have any ideas?

Thanks for the help,

Mike