Thanks a lot Amol (and Maciek)! In between I found that I can go a different
way and use a TileList instead but I'm sure your ideas will be useful a bit
later for what I'm planning to do!

 

Maybe somebody can give me a hint with a different problem . I'm loading
several small images into a TileList Component. These images are 32x32
pixels in size. I've created my own ItemListRenderer where I'm using a HBox
(but a Canvas would do well too). My problem is that I cannot get rid of the
vertical gap between a row of tiles. I've set verticalGap in the
ItemListRenderer to 0 but there is always a gap of 4 or so pixels. But I'd
like to have no gap between the items. Horizontally there is no gap if I set
horizontalGap to 0 but verticalGap seems not to do it and I've alsdo tried
various different components for it like Canvas, HBox, VBox etc. Any idea?

 

Thanks & Happy new year!

Sascha

 

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Amol Pandhare
Sent: Monday, 01 January, 2007 16:20
To: [email protected]
Subject: Re: [flexcoders] Getting a Sprite into a Flex Container?

 

Hey Sascha,

I hope this is what you were looking for.

I have a class which extends Sprite as below:

package {
    public class myShape extends Sprite {
    .
    .
    .
    .
    .
    }
}

Now I have my owns custom component class file which I have added as
follows:

First in the Application tag of your mxml file, mention a additional
attribute as 'xmlns:greet="com.*"'. Here refer to the package where your
custom component class is. 

Now use following to add the component to the Flex mxml file:
        <greet:test id="apiref" /> 

     Here 'greet' is the xmlns which we added in the application tag and
'test' is my custom component class. You have to be careful to extend your
custom component class with the UIComponent class like:

package com {
    //import myShape class if not in same package.
    public class test extends UIComponent {
    ..
       public function test() {
          var shapeObj:myShape = new myShape();
          addChild(shapeObj);
       }
    .
    }
}

Now in the test class you can add the earlier Sprite extended class by
creating its object as above.

This should solve your purpose. Now the above mentioned test class can
extend any of the Classes like  Canvas, or any container class. But
UIComponent happens to be the base class to all the container classes n so
UIComponent could be best opted choice.

Regards,
Amol.

----- Original Message ----
From: Sascha <[EMAIL PROTECTED]>
To: [email protected]
Sent: Saturday, December 30, 2006 3:40:33 PM
Subject: [flexcoders] Getting a Sprite into a Flex Container?

Hi,

I got a class that extends Sprite that I want to put into a Flex
DisplayObject container (Canvas or any similar custom made component). My
question is:
Is implementing the IUIComponent interface the only way to get this working
or
Are there any other ways around it? A SWFLoader is not what can use in this
situation. Any hints would be appreciated.

Thanks in advance,
Sascha

 


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

 

Reply via email to