Flash Combobox setStyle works in Test (debug) and not in Publish (swf)

by filip 25. August 2011 12:15

I tried to customize the combobox ( AS3 ), and everything was working fine by using cbo.setStyle( "embedFonts" ) and cbo.setStyle( "textFormat" ) while testing the movie.  However, when I published the SWF, the styles were no longer working.

It seems like setStyle doesn't really work properly for comboboxes for some reason.  The solution was to apply the setStyle to the textField inside the combobox, and not to the combobox itself.

For example, this doesn't work: 

 

cbo.setStyle( "embedFonts", true );
cbo.setStyle( "textFormat", tf );

 

but this works:

cbo.textField.setStyle( "embedFonts", true );
cbo.textField.setStyle( "textFormat", tf );

 

Tags: , ,

Web Development

Change the color of the trendline value in FusionCharts v3 for Flash

by filip 14. October 2010 18:07

It seems like FusionCharts does not support changing the color of a trendline via the TRENDVALUES style application.  The color always seems to default to the color of the trendline.

The fix to this issue involves modifying the source of the XYPlotChart.as file (you’ll need the source for fusioncharts to be able to do this).

Search the file for the following line (it should be line 1789):

trendFontObj.color = this.trendLines [i].color;

Right afer this line, paste the following code:

if ( this.styleM.getTextStyle (this.objects.TRENDVALUES).color != undefined )
               {
                    trendFontObj.color = this.styleM.getTextStyle (this.objects.TRENDVALUES).color;
                }

There may be a more “elegant” way of doing this, but the code above will enable you to change the color of trend value lines by using styles in fusioncharts.

Tags: ,

Web Development

How To Make the ActionScript 3.0 (AS3) TextArea Not Selectable

by filip 18. September 2010 01:50

Here’s something I wasted like 45 minutes on, and it should be pretty trivial. I needed to make the TextArea component NOT selectable, yet still enabled (need the scrollbar to work).

I started digging around the TextArea.as class, because no matter what I did in my code (such as myTextArea.textField.selectable = false; ), the TextArea was still selectable. It appears that when the TextArea calls the draw() or setSize() methods, it updates the text field in the TextArea to be selectable depending on whether the TextArea is enabled or not.

Clearly, whoever designed the TextArea component didn’t give this much thought. In any case, the way I got around the issue is to attach to the Event.Render event of the text area. Therefore, after the render method is called (and the TextArea is drawn), I can update the textfield to not be selectable.  Here is some sample code.You may need to attach to more events than just the render event, but the concept should work.

var DescriptionField:TextArea = getChildByName( "description" ) as TextArea;
DescriptionField.addEventListener( Event.RENDER, onDescriptionRender );

public function onDescriptionRender( evt:Event ):void
{
     var textArea:TextArea = evt.target as TextArea;
     textArea.textField.selectable = false;       
}

Tags: , ,

Web Development

About Filip Stanek

Death Note Pic I'm a developer at ACG in Cincinnati, OH. I like ASP.NET, Flash, and other web technologies, & enjoy playing chess, video games, etc.

Currently playing:

Disqus

Month List