FORUMS: list search recent posts

SWF communication to HTML

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jamolhon Ahmedov
SWF communication to HTML
on Nov 13, 2009 at 2:40:33 pm

Greetings to all,
got an issue and question that I have stucked with.

I have a website completely done in Flash 8 (AS2).
Have simple 4 buttons to change the colours of the main page background, like:

Red, Yellow, Blue and Gray buttons associated with relative coloured images and controlled with simple "gotoAndStop" AS.

The Problem:
Obviuosly, when I published the files to the server, main SWF not effecting the Index.html background.


Appreciate your help in advence,

Return to posts index

Pieter Helsen
Re: SWF communication to HTML
on Nov 13, 2009 at 9:11:47 pm

Hi, the way you can fix that is by using ExternalInterface. you can read about it here.

Basically, what external interface does is... It calls a javascript function inside your html file. So you would just have a javascript function like this:

[code]function changeColor(color){;

and then you just call that function, using external interface in flash"changeColor", "#FF0000");

Make sure you import the class.

Kind regards,

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.

Return to posts index

Jamolhon Ahmedov
Re: SWF communication to HTML
on Nov 13, 2009 at 9:42:27 pm

Hello Pieter,
thank you for your help.

I am sorry, I am new to programming and scripting.

I should have stressed enough that I am not changing the BACKGROUNG COLOUR(s) itself. BUT THE BACKGROUND FILES, WHICH I WANT TO USE AS A BACKGROUND.

I am using the patterned image for my FLASH project background, so it should continuous in HTML as well.

So, when I press, lets say Red background colour Button - my Flash project background is changing to Red patterned (PNG file), SO AT THE SAME TIME HTML SHOULD USE THE RED PNG FILE.

I would appreciate if you could help me on:
1. Action script ( to send the link )
2. HTML code to catch the link and change the back PNG files.
3. Java script.

Thank you

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved