PDA

View Full Version : HTML to Flash


Schwan
08-10-2007, 07:32 PM
I'm working on a site where I have a functional text link named "scroll to section" in HTML that looks like this:

<a href="javascript:;" onclick="dw_scrollObj.scrollToAnchor('section', 'wn', 'lyr1', 500)">scroll to section</a>

I want to change the boring text link to a Flash button. I have the button. I need to know how to convert that HTML to Flash actionscript that runs that javascript in my page. Any help would be greatly appreciated.

CyanBlue
08-10-2007, 07:40 PM
Howdy and Welcome... :)

First of all, make sure you have that JavaScript function in your HTML page that is visible to Flash...

Open up the Flash IDE...
Create a button...
Give it an instance name of 'scroll_btn'...
Create a new layer and name it 'Action'...
Select the frame 1 of that layer and type in this script...
scroll_btn.onPress = function ()
{
getURL("javascript:scrollToAnchor('section', 'wn', 'lyr1', '500');void();");
}
Publish the SWF...
Edit the HTML file to embed that SWF file instead of the text...
Open up the HTML file into the web browser and test... :)