You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Dennis Raddle <de...@gmail.com> on 2013/07/17 01:01:19 UTC

using spark.components.Label through pure ActionScript

I wrote some code using spark.components.Label, something very simple, and
I don't see anything when I run this.

  import flash.display.*;
  import flash.text.*;
  import layout.Layout;
  import spark.components.Label;

  public class App1 extends Sprite {


    public function App1() {
      var t:Label = new Label();
      t.text = "Foo Foo";
      addChild(t);
      t.x = 100;
      t.y = 100;
      trace(t.width);
    }

  }

What am I doing wrong?

-Dennis

Re: using spark.components.Label through pure ActionScript

Posted by Jeffry Houser <je...@dot-com-it.com>.
  App1 extends sprite; which means you probably aren't in a Flex project 
and there are no Flex specific classes to force the Spark Label through 
its lifecycle process.

  In theory you could write your own "SystemManager" class to put Flex 
components through their livecycle and handle invalidation / validation 
/ etc...

  But, I wouldn't expect it to be easy.


On 7/16/2013 7:01 PM, Dennis Raddle wrote:
> I wrote some code using spark.components.Label, something very simple, and
> I don't see anything when I run this.
>
>    import flash.display.*;
>    import flash.text.*;
>    import layout.Layout;
>    import spark.components.Label;
>
>    public class App1 extends Sprite {
>
>
>      public function App1() {
>        var t:Label = new Label();
>        t.text = "Foo Foo";
>        addChild(t);
>        t.x = 100;
>        t.y = 100;
>        trace(t.width);
>      }
>
>    }
>
> What am I doing wrong?
>
> -Dennis
>


-- 
Jeffry Houser
Technical Entrepreneur
http://www.jeffryhouser.com
203-379-0773


Re: using spark.components.Label through pure ActionScript

Posted by Dennis Raddle <de...@gmail.com>.
I'm not using an IDE. Yes that's pretty much all the code. I'm just
experimenting right now. I have gotten mxml files to work, so for now I'll
use that route if I want to use Flex components. I'm not sure if my project
really needs Flex. It might be pure ActionScript.




On Tue, Jul 16, 2013 at 4:16 PM, Lee Burrows
<su...@leeburrows.com>wrote:

> ...but that may not be enough. what IDE are you using? is this the entire
> code of your app?
>
>
>
> On 17/07/2013 00:14, Lee Burrows wrote:
>
>> Flex components cant be placed inside Sprites. Try extending
>> spark.components.Application instead of Sprite
>>
>> On 17/07/2013 00:01, Dennis Raddle wrote:
>>
>>> I wrote some code using spark.components.Label, something very simple,
>>> and
>>> I don't see anything when I run this.
>>>
>>>    import flash.display.*;
>>>    import flash.text.*;
>>>    import layout.Layout;
>>>    import spark.components.Label;
>>>
>>>    public class App1 extends Sprite {
>>>
>>>
>>>      public function App1() {
>>>        var t:Label = new Label();
>>>        t.text = "Foo Foo";
>>>        addChild(t);
>>>        t.x = 100;
>>>        t.y = 100;
>>>        trace(t.width);
>>>      }
>>>
>>>    }
>>>
>>> What am I doing wrong?
>>>
>>> -Dennis
>>>
>>>
>>
>> --
>> Lee Burrows
>> ActionScripter
>>
>
>
> --
> Lee Burrows
> ActionScripter
>
>

Re: using spark.components.Label through pure ActionScript

Posted by Lee Burrows <su...@leeburrows.com>.
...but that may not be enough. what IDE are you using? is this the 
entire code of your app?


On 17/07/2013 00:14, Lee Burrows wrote:
> Flex components cant be placed inside Sprites. Try extending 
> spark.components.Application instead of Sprite
>
> On 17/07/2013 00:01, Dennis Raddle wrote:
>> I wrote some code using spark.components.Label, something very simple, and
>> I don't see anything when I run this.
>>
>>    import flash.display.*;
>>    import flash.text.*;
>>    import layout.Layout;
>>    import spark.components.Label;
>>
>>    public class App1 extends Sprite {
>>
>>
>>      public function App1() {
>>        var t:Label = new Label();
>>        t.text = "Foo Foo";
>>        addChild(t);
>>        t.x = 100;
>>        t.y = 100;
>>        trace(t.width);
>>      }
>>
>>    }
>>
>> What am I doing wrong?
>>
>> -Dennis
>>
>
>
> -- 
> Lee Burrows
> ActionScripter


-- 
Lee Burrows
ActionScripter


Re: using spark.components.Label through pure ActionScript

Posted by Lee Burrows <su...@leeburrows.com>.
Flex components cant be placed inside Sprites. Try extending 
spark.components.Application instead of Sprite

On 17/07/2013 00:01, Dennis Raddle wrote:
> I wrote some code using spark.components.Label, something very simple, and
> I don't see anything when I run this.
>
>    import flash.display.*;
>    import flash.text.*;
>    import layout.Layout;
>    import spark.components.Label;
>
>    public class App1 extends Sprite {
>
>
>      public function App1() {
>        var t:Label = new Label();
>        t.text = "Foo Foo";
>        addChild(t);
>        t.x = 100;
>        t.y = 100;
>        trace(t.width);
>      }
>
>    }
>
> What am I doing wrong?
>
> -Dennis
>


-- 
Lee Burrows
ActionScripter


Re: using spark.components.Label through pure ActionScript

Posted by Alex Harui <ah...@adobe.com>.
Flex is a framework and most frameworks have bootstrap/startup
requirements.  For Flex, it pretty much requires that you use an MXML file
with an Application tag at the top.
It is technically possible to build out from pure AS, but very difficult.

It is a goal of FlexJS to not require an MXML file, but it will probably
still require a subclass of an Application class.

-Alex

On 7/16/13 4:01 PM, "Dennis Raddle" <de...@gmail.com> wrote:

>I wrote some code using spark.components.Label, something very simple, and
>I don't see anything when I run this.
>
>  import flash.display.*;
>  import flash.text.*;
>  import layout.Layout;
>  import spark.components.Label;
>
>  public class App1 extends Sprite {
>
>
>    public function App1() {
>      var t:Label = new Label();
>      t.text = "Foo Foo";
>      addChild(t);
>      t.x = 100;
>      t.y = 100;
>      trace(t.width);
>    }
>
>  }
>
>What am I doing wrong?
>
>-Dennis