Title: Re: [flexcoders] Re: Unable to Dynamically Changing BG image
Okay, I confess, in the Flex Style Explorer I faked the dynamic application background switching.   It’s really the following (this is simplified, but should explain the point):

<mx:Application marginLeft=”0” marginTop=”0” marginRight=”0” marginBottom=”0”>
    <mx:VBox width=”100%” height=”100%” id=”myBackground”>

    <mx:VBox>
</mx:Application>

With setStyle calls pointing to the VBox, not the application.  (e.g. myBackground.setStyle(‘backgroundColor’, 0xFF0000); )

Sorry for being so sneaky.

-Peter


On 1/25/06 4:18 PM, "Kevin Ewok" <[EMAIL PROTECTED]> wrote:

Binding is not allowed to style property "backgroundImage". In fact,
you can't use binding for any "styleName" attribute. I don't know why
I'm struggling with this so much. Even if I have a simple label like so:
<mx:Label id="tst" text="My text" styleName="myStyleClass"/>

 I can't change the color of it issuing the call:

mx.styles.StyleManager.styles.myStyleClass.color="#000000";

It simply always stays to the original style as declared in the css.

--- In [email protected], "Stacey Mulcahy" <[EMAIL PROTECTED]> wrote:
>
> 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
>
<http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site
>
+design+development&w2=Computer+software+development&w3=Software+design+and+
>
development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=1
> 66&.sig=L-4QTvxB_quFDtMyhrQaHQ>  site design development
>
> Computer
>
<http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+si
>
te+design+development&w2=Computer+software+development&w3=Software+design+an
>
d+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s
> =166&.sig=lvQjSRfQDfWudJSe1lLjHw>  software development
>
> Software
>
<http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+
>
site+design+development&w2=Computer+software+development&w3=Software+design+
>
and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5
> &s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>  design and development
>
>
> Macromedia
>
<http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+deve
>
lopment&w2=Computer+software+development&w3=Software+design+and+development&
>
w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6n
> PIrz7_EpZI36cYzBjw>  flex
>
> Software
>
<http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=W
>
eb+site+design+development&w2=Computer+software+development&w3=Software+desi
>
gn+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&
> c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>  development best practice
>
>  
>
>  
>
>   _____  
>
> YAHOO! GROUPS LINKS
>
>  
>
> *       Visit your group "flexcoders
> <http://groups.yahoo.com/group/flexcoders> " on the web.
>   
> *       To unsubscribe from this group, send an email to:
>  [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>   
> *       Your use of Yahoo! Groups is subject to the Yahoo!
> <http://docs.yahoo.com/info/terms/>  Terms of Service.
>
>  
>
>   _____
>






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


 
 
 

YAHOO! GROUPS LINKS


 




8888/ \8888®   PETER BAIRD
888/   \888    
User Experience Consultant
88/  /  \88    Adobe Consulting | Adobe Systems, Inc
8/  /8\  \8    275 Grove St. Newton, MA
/  /888\  \    Office: 617.219.2126 | Cell: 617.803.6804
      \8\       AIM: pbaird00 | Y!IM: pbaird00




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




YAHOO! GROUPS LINKS




Reply via email to