Discussion:
Why doesn't onClick work for Flash Text?
(too old to reply)
LisaS77
2004-06-02 21:05:36 UTC
Permalink
I'm a newbie to Dreamweaver and web development and need assistance. I have
multiple layers on a form and wish to show/hide layers using the onClick event
of Flash Text. In searching the forums I have learned that there is a free
extension to do this, however, I remain curious about why the onclick event is
not recognized in the browser. The show/hide layers behavior in the behavior
panel works just fine on mouseover and mouse out, unfortunately I want it to
work onclick! I have the same issue with Flash Buttons. What's the deal?

Related question: I've had some success using javascript and the DOM to
control objects on the page. If I insert a javascript command to set onclick
to run a custom function and place the script command after the HTML
instantiation of the layer object, would this be successful?
darrel
2004-06-02 21:41:50 UTC
Permalink
Post by LisaS77
multiple layers on a form and wish to show/hide layers using the onClick event
of Flash Text.
You can't. 'Flash Text' is an embedded object. As such, it's not really a
part of the page that javascript or HTML can 'see'. Any clicking in the
flash file is trapped by the flash browser plug-in so the html page doesn't
even register the click.

If you want to show/hide layers via the flash text, then you need to open up
the flash text inside of Flash and create a button in flash with the
javascript there.

-Darrel
LisaS77
2004-06-02 22:24:46 UTC
Permalink
Interesting. I used the Dreamweaver MX 2004 Flash Text feature to create the
flashtext so there isn't (to my knowledge) a source flash file to work from.
Interesting also that the Behaviors panel offers the onClick event for the
Flash Text object and surrounds it with the embed tags, which I would have
thought would allow the object to respond to onclick. No can do, however. So,
to clarify, what native HTML objects WILL respond to onClick within the
Dreamweaver interface?
Greg Ludington
2004-06-02 22:44:42 UTC
Permalink
Post by LisaS77
Interesting. I used the Dreamweaver MX 2004 Flash Text feature to create the
flashtext so there isn't (to my knowledge) a source flash file to work from.
Look in your code view, or select the Flash Text in Design View and look at
the properites. Dreamweaver is creating a Flash movie for you, such as
"text1.swf" to display your text. Since it is a Flash movie, that object
has first choice what to do with the click, and how (or if) to pass it on to
the browser.
Mick White
2004-06-02 22:41:55 UTC
Permalink
Double click the Flash Text.
In link area write:
javascript:yourFunction(yourParameters;anyOtherFunctionOrJSStatements)

If your parameters are strings, enclose them in single quotes:

javascript:yourFunction('yourStringParameters',yourJsVariable)

example:
javascript:alert('The year is '+new Date().getFullYear())

Mick
Post by LisaS77
I'm a newbie to Dreamweaver and web development and need assistance. I have
multiple layers on a form and wish to show/hide layers using the onClick event
of Flash Text. In searching the forums I have learned that there is a free
extension to do this, however, I remain curious about why the onclick event is
not recognized in the browser. The show/hide layers behavior in the behavior
panel works just fine on mouseover and mouse out, unfortunately I want it to
work onclick! I have the same issue with Flash Buttons. What's the deal?
Related question: I've had some success using javascript and the DOM to
control objects on the page. If I insert a javascript command to set onclick
to run a custom function and place the script command after the HTML
instantiation of the layer object, would this be successful?
LisaS77
2004-06-03 00:00:35 UTC
Permalink
Mick -- YES! You got it in one. Thanks!

In case anyone else ever looks this post up for reference, let me explain what
I did:

I wanted to have a list of courses using a custom font that when the list
elements were clicked would display a layer containing text and other objects
particular to the selected course. I decided on Flash Text because it allows
embedded fonts that are not browser dependent and also responds to mouseover
events and of course onclick. As Mick suggested, I dbl clicked on the flash
text object and typed in javascript: myfunctionname in the link field. I did
not need to write a function for this as DW provides a behavior for show/hide
layers. I simply called the DW script from the link function, provided it with
the appropriate arguments and set the target to _top. Voila! Works like a
charm.

I was halfway to another solution as well, using a null hyperlink. In this
case, I used an inline CSS to remove the underline and change the text color of
the link. Next, I added the behavior from the behavior panel and attached it
to the onclick event. This worked very well too, but of course I needed to
then write mouseover and mouseout functions to create rollover effects for the
text. All this was fine, but I was still stuck with browser installed fonts --
yuck.

Cheers Mick!
Mick White
2004-06-04 01:24:12 UTC
Permalink
No problem...
Mick
Post by LisaS77
Mick -- YES! You got it in one. Thanks!
In case anyone else ever looks this post up for reference, let me explain what
I wanted to have a list of courses using a custom font that when the list
elements were clicked would display a layer containing text and other objects
particular to the selected course. I decided on Flash Text because it allows
embedded fonts that are not browser dependent and also responds to mouseover
events and of course onclick. As Mick suggested, I dbl clicked on the flash
text object and typed in javascript: myfunctionname in the link field. I did
not need to write a function for this as DW provides a behavior for show/hide
layers. I simply called the DW script from the link function, provided it with
the appropriate arguments and set the target to _top. Voila! Works like a
charm.
I was halfway to another solution as well, using a null hyperlink. In this
case, I used an inline CSS to remove the underline and change the text color of
the link. Next, I added the behavior from the behavior panel and attached it
to the onclick event. This worked very well too, but of course I needed to
then write mouseover and mouseout functions to create rollover effects for the
text. All this was fine, but I was still stuck with browser installed fonts --
yuck.
Cheers Mick!
Loading...