Are any of the images showing up as there are no embed calls. ?

 

What about just setting the styles in a css file externally and changing the styleName on the fly by binding the bgimage to a variable?

 

 

 

Someone can correct me here, but isn’t setStyles one of the most intensive processes due to the notifications to each item. Going to the global, I would suspect wouldn’t be as bad – but I really could just be talking out of my ass. Its been known to happen.

 

Also, I’ve done the below in 2- not sure about 1.5.

Or you could do something like( I did these recently for a cell rendered and worked like a charm)

 

<<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundImage=”{sourceItem}” >

 

  <mx:Script>
  <![CDATA[  

 

 

    [Embed(source="assets/image.png")]

       var graphicImage:Class;

         

    [Embed(source="assets/image2.png")]

       var graphicImage2:Class;

  

  [Bindable]

          public var sourceItem:Class;

 

 

         
  function changeStyle() : Void
      {  

     sourceItem=graphicImage2      
    }
  ]]>
</mx:Script>

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Ewok
Sent: Wednesday, January 25, 2006 1:43 PM
To: [email protected]
Subject: [flexcoders] Unable to Dynamically Changing BG image

 

I've spent a lot of time researching this issue within flexcoders,
Google, and iteration::two book and still no luck.

I'm basically trying to replicate what the Flex Style Explorer
(http://weblogs.macromedia.com/mc/archives/FlexStyleExplorer.html)
does where a user can choose their own background and styles.

I cannot get this to work for the life of me. I've read everywhere
that once you declare a theme, that's it. You can't dynamically swap
in a new one. In my code below, I'm basically trying to swap
background images but it won't work. Any ideas?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" >
  <mx:Script>
  <![CDATA[           
  function changeStyle() : Void
      {        
mx.styles.StyleManager.styles.global.setStyle("background-image",
'backgrounds/redStripe.swf');
                  }
  ]]>
</mx:Script>
<mx:Style>
  global { background-image: 'backgrounds/industrial.swf';
font-family: Helvetica; font-size: 12pt}      
</mx:Style>
<mx:Panel>
  <mx:Button label="Change Image!" click="changeStyle();"></mx:Button>
</mx:Panel>
</mx:Application>



I also tried in my method passing in the following 'myRedBG' embedded
image var and that didn't work either.

[Embed(source="backgrounds/redstripe.swf")]
var myRedBG:String;

Thanks in advance for any help. I even tried this with basic
background coloring changes and couldn't get it to work so I feel I'm
missing something fundamental here.






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to