Hello Gordon,

Some Update:

I found that when I compile only the MyTable.as file, nothing shows up.  When I wrap it in an mxml file, then it works.

----- TestMain.mxml -------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"xmlns="*">
    <MyTable />
</mx:Application>

------------------

Essentially, my real app has the following format.

TestMain.mxml calls MyTable, and MyTable calls MyTable1 (which is the same structure as MyTable). 

MyTable1 is called in MyTable.as file: ---------

    override protected function updateDisplayList(unscaledWidth:Number,
    unscaledHeight:Number):void {
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    // Check to see if style changed.
    if (bFillColorsChanged==true)
    {
    // Redraw gradient fill only if style changed.
    fillColorsData=getStyle("fillColors");
    graphics.beginGradientFill(GradientType.LINEAR, fillColorsData,
    alphas, ratios);
    graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
   
    var table1:MyTable1 = new MyTable1();
    addChild(table1);

    }
--------------------

It seems to me that the problem I am having in Beta3 is due to the fact that Beta3 doesn't show the MyTable.as file by itself, it only works when wrapped by an mxml file.

I hope that this situation has an easy solution as the comp0nent I have been building took a while to make and a big change would be a bit of a disaster.

Thanks again for helping out on this.  Definitely Appreciated Big Time.

Cheers,

Tim












--- In [email protected], "sufibaba" <[EMAIL PROTECTED]> wrote:
>
> Hi Gordon,
>
> I am trying out a few things, below is an example from the Extending
> Components.pdf docs, but it doesn't seem to be working. Can you see
> if it works for you?
>
> ------------------------------------------
>
> package
> {
> import mx.core.UIComponent;
> import mx.styles.CSSStyleDeclaration;
> import mx.styles.StyleManager;
> import flash.display.GradientType;
> // Insert the [Style] metadata tag to define the name, type
> // and other information about the style property for the
> // MXML compiler.
> [Style(name="fillColors",type="Array",format="Color",inherit="no")]
>
> public class MyTable extends UIComponent
> {
> // Define a static variable for initializing the style property.
> private static var classConstructed:Boolean = classConstruct();
> // Define a static method to initialize the style.
>
> private static function classConstruct():Boolean {
> if (!StyleManager.getStyleDeclaration("MyTable"))
> {
> // If there is no CSS definition for StyledRectangle,
> // then create one and set the default value.
> var newStyleDeclaration:CSSStyleDeclaration =
> new CSSStyleDeclaration();
> newStyleDeclaration.setStyle("fillColors", [0xFF0000, 0x0000FF]);
> StyleManager.setStyleDeclaration("MyTable",
> newStyleDeclaration, true);
> }
>
> return true;
> }
> // Constructor
> public function MyTable() {
> super();
> }
> // Define a default size of 100 x 100 pixels.
>
> override protected function measure():void {
> super.measure();
> measuredWidth = measuredMinWidth = 100;
> measuredHeight = measuredMinHeight = 100;
> }
>
> // Define the variable to hold the current gradient fill colors.
> private var fillColorsData:Array;
> // Define the flag that indicates a change to fillColors.
> private var bFillColorsChanged:Boolean = true;
> // Define variables for additional controls on the fill.
> // You can create style properties for these as well.
> private var alphas:Array = [1.0, 1.0];
> private var ratios:Array = [0x00, 0xFF];
> // Override styleChanged() to detect changes in your new style.
> override public function styleChanged(styleProp:String):void {
> super.styleChanged(styleProp);
> // Check to see if style changed.
> if (styleProp=="fillColors"){
> bFillColorsChanged=true;
> invalidateDisplayList();
> return;
> }
> }
>
> // Override updateDisplayList() to update the component
> // based on the style setting.
>
> override protected function updateDisplayList(unscaledWidth:Number,
> unscaledHeight:Number):void {
> super.updateDisplayList(unscaledWidth, unscaledHeight);
> // Check to see if style changed.
> if (bFillColorsChanged==true)
> {
> // Redraw gradient fill only if style changed.
> fillColorsData=getStyle("fillColors");
> graphics.beginGradientFill(GradientType.LINEAR, fillColorsData,
> alphas, ratios);
> graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
> }
> }
> }
> }
>
> -----------------
>
> Cheers,
>
> Tim
>
>
>



--
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