PDA

View Full Version : tileable <simplelayout/>?


girardjf
01-22-2003, 10:12 AM
Hello,

Just a suggestion, but it might be efficient if the <simplelayout/> tag had
a parameter to specify how many <resource/> images to place on an axis.

I realize that a script could be written, or the resource could be created
with the width or height in mind, but as we all know often these values are
arbitrary and/or vary.

Maybe something like: <simplelayout axis="y" tileNum="6" spacing="0"/>.

It occurs to me that this would also make the code appear a lot cleaner.

Someone please tell me if this sounds stupid. In my case it is simply for a
background image.

-justin :rolleyes:

antun
01-22-2003, 10:45 AM
Hey Justin

Actually you could do this yourself; just create a custom class for it. The class would be the encasing view, and you'd put the tiled views in there:-


<canvas debug="true">
<class name="myTiler">
<attribute name="tileNum" value="1" />
<view name="images" oninit="hideExtraViews()">
<!-- images go here -->
<simplelayout axis="y" spacing="0" />
<method name="hideExtraViews">
<![CDATA[
var highestIndx = parent.tileNum - 1;
for ( var i=0; i<this.subviews.length; i++ ) {
if ( i > highestIndx ) {
this.subviews[i].setVisible( false );
}
}
]]>
</method>
</view>
</class>

<myTiler name="bunchPics" tileNum="3">
<view width="30" height="30" placement="images" bgcolor="blue" />
<view width="30" height="30" placement="images" bgcolor="red" />
<view width="30" height="30" placement="images" bgcolor="green" />
<view width="30" height="30" placement="images" bgcolor="yellow" />
</myTiler>

</canvas>


Notice how the yellow box does not appear? The script basically loops through all the tiled images, and hides those that are more than the maximum allowable.

-Antun

girardjf
01-22-2003, 11:26 AM
Hey,

Jerry suggested that yesterday. My thought was that perhaps an attribute could be built in. Maybe that way the "tileNum" could be iterated through using a variable retrieved from an XML file.

Perhaps a method could be built in as well. That way the script could be avoided.

Maybe that doesn't make any sense.

-j:rolleyes:

hqm
01-23-2003, 07:26 PM
If people end up using tiled resources a lot, then it would be more efficient to build that iteration into the base view class, so it could just instantiate multiple low-level Flash resources, and it wouldnt need the overhead of instantiating full Laszlo views for each tile. We can add this to the feature wishlist.

girardjf
01-23-2003, 07:52 PM
Cool!

-j :D