views:

240

answers:

3

When I make changes to a Flex project and rerun the project, it seems that FlashBuilder4 rewrites my html wrapper that embeds the SWF. But I have additional javascript code in the html wrapper and don't want to keep losing my code. I had to re-write the code once and it was a pain in the neck.

How do I stop it from re-writing the html. And the related question: how do I stop it from deleting the html during a clean?

I basically need to exclude the html from its processing once it's been created the first time.

P.S. I'm using Flash Builder 4, but I suppose it's the same in Flex Builder 3.

+3  A: 

Turn off "Generate HTML Wrapper file" in Project settings.

Generate HTML Wrapper file

This will delete the auto-generated HTML wrapper file in your bin directory. If you need to keep it, make a copy first and put it back after turning off this option.

Sam
+1  A: 

If Flash Builder 4 is indeed based off Flex Builder 3 as you mentioned then the real solution you are looking for is to edit the HTML wrapper template in <Flex-Project-Folder>/html-template/index.template.html and put your own modifications there.

You need to be mindful of the tokens used in the template while editing this file as they will be replaced when the HTML wrapper is generated when you perform a build.

For instance -

<title>${title}</title> 

will be replaced with the pageTitle you set in your Application mxml -

<mx:Application 
        xmlns:mx="http://www.adobe.com/2006/mxml"      
        pageTitle="Flex Project"
        width="100%"
        height="100%">

   </mx:Application>

HTH

Saheed
A: 

I had the same problem with FB4. My project is an ActionScript project. All you have to do is drop [SWF(width="300", height="300", backgroundColor="#ffffff", frameRate="30")] into your default package beneath the imports and it will use these setting to generate the HTML.

Howie

Ward