I have a spark list component and a corresponding custom itemrenderer:
list component:
<s:List id="albumImagesList" itemRenderer="the.namespace.for.XYZImageRenderer" useVirtualLayout="false" width="400" height="160">
<s:layout>
<s:TileLayout requestedColumnCount="5"
requestedRowCount="2"
rowHeight="80"
columnWidth="80"
horizontalGap="0"
verticalGap="0" />
</s:layout>
</s:List>
item renderer:
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="true" width="100%" height="100%">
<s:states>
<s:State name="normal" />
</s:states>
<s:BitmapImage source="{data.image_path}" width="70" height="70" horizontalCenter="0" verticalCenter="0" />
</s:ItemRenderer>
It's all fine and dandy, the data gets populated correctly and I verified that the data.image_path property arrives safe and sound inside the itemrenderer.
My only problem is: the image is not displaying. I am not sure if it doesn't render at all or if it's just not visible somehow.
Does anyone see something at first glance? Am I doing something fundamentally wrong here? I worked with mx item renderers before and I never had so much trouble with those.
after a little bit of fumbling and checking i suppose this is the answer to my question. maybe someone can confirm this, but i think it is pretty much spot on:
the "bitmapimage" can only load data from trusted (crossdomain-policy'ed) domains. so with local files it is no problem, but i was loading remote images and with that the bitmapimage silently shuts down and does nothing. no get request, nothing.
the old "image" can load stuff no matter where it originated and so i am now switching to this as a solution.
BitMapImage.source expects one of three things. To quote from docs:
A Bitmap or BitmapData instance.
A class representing a subclass of DisplayObject. The BitmapFill instantiates the class and creates a bitmap rendering of it.
An instance of a DisplayObject. The BitmapFill copies it into a Bitmap for filling.
It sounds like you're giving it a URL location. If so, then use an Image, not BitMapImage.
phew, ok got it fixed using this guy's approach:
http://polygeek.com/2452_flex_extending-spark-bitmapimage
maybe it's going to be of help for someone.
cheers!
Related
I am planning to add an input field (just like an EditText) to my Card. I am using the GDK. At present I have created a layout as below
<TextView
android:id="#+id/txt1"
android:text="Which task do you want?"
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/edit1"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint=""/>
However, the EditText is not the one I need since using glass we can't type.
So can anyone tell me how to add input fields to card?
As mentioned in comments, there is no easy way to actually type into an input field so there is no need to use the features of an input, instead you can just style a TextView to look like an input field (typically with a border around it) and update the value from the back end as needed
((TextView)findViewById(R.id.my_text_view)).setText(myStringValue);
I am developing Desktop Application using Flex/AIR and I have problem with Spark List control.
The case is the following:
I have a list with item renderer. I do not use itemRendererFunction, so I have just one type of renderer. However this renderer can have different size, depending of the type of the data connected to it. Please see the code of my ItemRenderer:
<s:HGroup verticalAlign="middle">
<s:CheckBox id="glazingNorthCheckBox" selected="false"/>
<s:TextInput text="{data is VerticalSolidComponent ? data.window.areaNorth : data.skylight.area}"/>
<s:Label text="m²"/>
</s:HGroup>
<s:HGroup verticalAlign="middle" includeInLayout="{data is VerticalSolidComponentWithGlazing}"
visible="{data is VerticalSolidComponentWithGlazing}">
<s:CheckBox id="glazingEastCheckBox" selected="false"/>
<s:TextInput text="{data.window.areaEast}"/>
<s:Label text="m²"/>
</s:HGroup>
So as you see the second HGroup is not always included in layout.
That is why my list is calculating wrong height.
Here you can see the code for the list:
<s:List id="solidComponentsList" dataProvider="{data.solidComponents}" itemRenderer="View.BuildingGeometry.DetailView.SolidComponentItemRenderer" skinClass="View.Skins.CustomListSkin" useVirtualLayout="true">
<s:layout>
<s:VerticalLayout gap="10" horizontalAlign="left" variableRowHeight="true" useVirtualLayout="true" paddingTop="20" paddingLeft="20" requestedMaxRowCount="4"/>
</s:layout>
</s:List>
Can you give me some advice how to calculate the correct size of the list?
Thank you in advance!
The Crosssells do not seem to be working on my Magento EE install, for the product view page.
Ive debugged the product list crosssells block, but seems to crash out somewhere on its way through the various code, whilst collecting the collection. Cant work out why (whitescreens when debug to a certain level...and item collection thus not being set. Hard to figure out. No exceptions being logged).
I have no errors on the install...and sure i should not need to edit any logic, as the functionality is provided by default.
Ive followed this example:
http://www.magentocommerce.com/boards/viewthread/51529/
My crossells show on the cart page, as they usually do...but i cant get them to display on my product view page.
Heres my bits of code:
Catalog.xml:
<block type="catalog/product_list_crosssell" name="product.info.crosssell" as="crosssell_products" template="catalog/product/list/crosssell.phtml"/>
product/list/crosssell.phtml:
if(count($this->getItems())): ?>
<div id="also_bought_productslist" class="inner">
<?php $i=0;
foreach ($this->getItems() as $product):
Anyone know what i may be missing. And has anyone added crossells to their product view page?
Just to clarify...THIS IS USING THE DEFAULT PRODUCT_LIST_CROSSELL block...and im NOT trying to utilise the checkout/cart/crossell code (i know this relies on cart functionality/data to work correctly. I did attempt this though, and still get no crossell items....but they DO show in the cart page.)
many thanks
Syntax within the catalog xml file. Namely, an AFTER="blahblah" declaration...and use of same block code twice
Old code:
<block type="catalog/product_list_crosssell" name="product.info.crosssell" as="crosssell_products" template="catalog/product/list/crosssell.phtml"/>
<block type="catalog/product_list_related" name="alsoboughttabs" after="forgettoaddproducts" template="pagetabs/alsobought_pagetabs.phtml" />
<block type="catalog/product_list_related" name="forgettoaddproducts" after="product.info" template="catalog/product/list/dontforgettoadd.phtml" />
New code:
<block type="catalog/product_list_crosssell" name="product.info.crosssell" as="crosssell_products" template="catalog/product/list/crosssell.phtml"/>
<block type="catalog/product_list_upsell" name="alsoboughttabs" template="pagetabs/alsobought_pagetabs.phtml" />
<block type="catalog/product_list_related" name="forgettoaddproducts" after="product.info" template="catalog/product/list/dontforgettoadd.phtml" />
I'm having an issue with a bit XSLT code I'm working with for a client. I cannot change the schema, as a flash application depends on it and making any changes would break the ActionScript. It's unfortunate.
This is my first foray into XSLT and I'm admittedly incompetant with it, so I was hoping the community could help me out.
This is the schema (XML file):
<statement title="Click on your Answer" answer="true">
True or False: The question asked is here.
<feedback>
<answerTrue sound="">
The response if the user answered true is here.
</answerTrue>
<answerFalse sound="">
The response if the user answered false is here
</answerFalse>
</feedback>
</statement>
When I try to access the "statement" like this (XSLT):
<div id="statement">
<xsl:value-of select="statement" />
</div>
It displays the "answerTrue" and "answerFalse" nodes along with it. I would like to only display the text "True or False: The ques...". If anyone knows of a tag I can use to display the statement without displaying the child elements, I'd be eternally grateful! Thanks!
Use:
normalize-space(/statement/text()[1])
How can print a page using xslt.
i need a link, or a button which when clicked invokes the print page printer dialog box.
I suspect you need to specify a bit more about what you are trying to do.
XSLT is simply a way to turn one block of text into another. The input is generally an xml buffer and the output is some text rendering of that buffer.
It is possible that you are trying to generate a script using XSLT and that you want that script to be able to open a print dialog when it is run by something e.g. you generate javascript, that then runs on a browser.
Can you describe in more detail what you want to achieve?
The following in an html page gives you a print link:
Print
XSLT is a language for transforming XML documents. That means you can add/modify content. Assuming your output is HTML, you can do this:
<xsl:template match="top">
<html>
<head>
</head>
<body>
<input name="print" type="button" value="Print"
onclick="javascript:window.print()">
<xsl:apply-templates />
</body>
</html>
</xsl:template>
But of course, where exactly the button has to go depends on your needs. I'd additionally, add a media=print specific CSS at the top so that the document comes out neat!