Group gets height from original image, not the scaled image - image

In my app I import a twitter timeline. Some tweets contain images, some don't. Also the height of the imqages is variabel. I have a set width of 90% to make sure the images fit in the group (with a vertical layout), but no matter what I do, the group gets it's height from the original image, not the scaled height. I tried setting variableRowHeight="true", but that doesn't seem to do anything.Here is some sample code:
<s:List id="list" y="0" width="90%" height="954" dataProvider="{tweets}" horizontalCenter="0">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<s:Group width="100%">
<s:Label id="twitlabel" text="{tweetImage.height}"
width="100%"
styleName="tweetlist"/>
<s:Image id="tweetImage" y="{twitlabel.height}" width="90%" horizontalCenter="0" scaleMode="letterbox" smooth="true" source="{data.entities.media[0].media_url}"/>
</s:Group>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
The question is, how can I get the group to set it's height to the scaled image height?

First set the "complete" event handler for your Image and an id for your Group:
<s:Group id="tweetImageGroup" width="100%">
<s:Image id="tweetImage" y="{twitlabel.height}" horizontalCenter="0" scaleMode="letterbox" smooth="true" source="{data.entities.media[0].media_url}" complete="tweetImage_completeHandler(event)"/>
Then set the width after the image has completed loading:
protected function tweetImage_completeHandler(event:Event):void{
tweetImageGroup.height = event.currentTarget.measuredHeight;
}
This might need some adjusting but should work if I understood your problem correctly.

Related

Enlarge frame for same page link/code

Is there any way i can enlarge this code so the frame shows bigger then it is rather then me having to scroll up and down to see it, as in width and height. its a show the link in same page code.
code:
<a href='link1.html' target='myIframe'>link1</a><br /> <iframe name='myIframe'></iframe>
figured it out
Code:
<a href='link1.html' target='myIframe'>link1</a><br /> <iframe name='myIframe' width="500" height="400"></iframe>

Image mask in Mozilla + foreignObject + Ajax

http://continent-news.info/page_20.html
In the left column of news, they opens in a popup window, and loaded with Ajax.
<div class="ukraine_mask1">
<svg height="116px" width="142px">
<defs>
<mask id="ukraine_mask1" maskContentUnits="userSpaceOnUse" maskUnits="userSpaceOnUse">
<image xlink:href="mask/ukraine_mask1.png" height="116px" width="142px">
</mask>
</defs>
<foreignObject class="recov_ukraine_mask1" style="mask: url(#ukraine_mask1);" height="100%" width="100%">
<div class="element_mask mask1_ukraine">
<img src="../inf_images/small/7812_8926.jpeg">
</div>
</foreignObject>
</svg>
</div>
problem in Mozilla:
Some news used map with a mask, the first time the mask works well. But if I click another news with mask, they does not want to re-use mask... =( If I press again the first news, it will work.
The second time, does not want to re-use =(
If in firebug disable / apply
mask: url ("# ukraine_mask1")
in
foreignObject class = "recov_ukraine_mask1"
it will work again ...
Maybe someone have an idea how to solve this problem?
I tried to add a simple style in СSS, but does not help = (

How to place image inline in Flex 4.6

I have a list of s checkboxes, and I would like to have a tiny image after each line of lebal text. Unfortunately default Flex fonts look a bit different on different OS and browser combinations, so I cannot place it there manually, but I need to attach it programmatically.
Here is how my checkboxes look like. I use Flex 4.6, how is it possible to do so ?
<s:CheckBox x="10" y="60" label="label1" id="1CB" click="modify();"/>
<s:CheckBox x="10" y="75" label="label2" id="2CB" click="modify();"/>
You can very well try this, the resolution will not change for differnent OS once the width and height of the images are set. Similarly an Image can be added through actionscript also.
<s:HGroup>
<s:CheckBox x="10" y="60" label="label1" id="CB"/>
<mx:Image source="#Embed('untitled.png')" width="50" height="50"/>
</s:HGroup>
<s:HGroup>
<s:CheckBox x="10" y="75" label="label2" id="CB2"/>
<mx:Image source="#Embed('untitled.png')" width="50" height="50"/>
</s:HGroup>
You can use embed fonts for this, they will be show equal in all OS. For examle, write in style file:
#font-face
{
fontFamily: HelveticaNeueLTStd;
src: url("assets/font/HelveticaNeueLTStd-Lt.otf");
embedAsCFF: true;
advancedAntiAliasing: true;
}
global
{
font-family: HelveticaNeueLTStd;
fontSize: 16;
}

firefox img rounded borders without using div background

It's a known bug that -moz-border-radius doesnt work on images in firefox. What's a way to get this functionality without resorting to putting the image as a background on a rounded div?
In current Firefox you can use SVG filters. Have an SVG file clip.svg like this:
<svg:svg height="0">
<svg:clipPath id="c1" clipPathUnits="objectBoundingBox">
<svg:rect x="0" y="0" rx="0.05" ry="0.05" width="1" height="1"/>
</svg:clipPath>
</svg:svg>
And apply it in CSS like this:
.target { clip-path: url(clip.svg#c1); }

Flex 4 custom component with children inserted directly into view stack

I give up. Hopefully I am just missing something easy, but I feel like I am pulling teeth trying to get this to work. All I want is a custom 'wizard' component whose children are placed within a ViewStack and beneath the ViewStack there is a next and back button. Here are some code excerpts to illustrate my approach:
WizardGroup.as:
[SkinPart(required="true")]
public var nextBt:Button = new Button();
[SkinPart(required="true")]
public var backBt:Button = new Button();
[SkinPart(required="true")]
public var stack:ViewStackSpark = new ViewStackSpark();
WizardGroupSkin.mxml:
<s:VGroup width="100%" height="100%"
paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10">
<container:ViewStackSpark id="stack" width="100%" height="100%">
<s:Group id="contentGroup" width="100%" height="100%" minWidth="0" minHeight="0"/>
</container:ViewStackSpark>
<s:HGroup horizontalAlign="right" width="100%">
<s:Button id="nextBt" label="Next" enabled="{hostComponent.permitNext}" enabled.last="false"/>
<s:Button id="backBt" label="Back" enabled="{hostComponent.permitBack}" enabled.first="false"/>
</s:HGroup>
</s:VGroup>
While this comes very close to working, the major problem is that the children of the WizardGroup component are not added as children of the viewstack. Instead, they are added as children of the contentGroup. So the viewstack will always only have one child: contentGroup.
I also tried the approach of binding the contents of the view stack to the children of contentGroup, but with Spark containers, there is no way to access an array of children or array of elements (ie, there is no contentGroup.getChildren() or contentGroup.getElements())
Any ideas? Thanks everyone.
I finally figured it out. The trick is to set the default property of the WizardGroup to a public member array I am calling "content"
[DefaultProperty("content")]
public class WizardGroup extends TitleWindow
{
[SkinPart(required="true")]
public var nextBt:Button = new Button();
[SkinPart(required="true")]
public var backBt:Button = new Button();
[Bindable]
public var content:Array;
And then within the skin, bind the content of the viewstack to the hostComponent's content array:
<s:VGroup width="100%" height="100%"
paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10">
<container:ViewStackSpark id="stack" width="100%" height="100%" content="{hostComponent.content}"/>
<s:HGroup horizontalAlign="right" width="100%">
<s:Button id="nextBt" label="Next" enabled="{hostComponent.permitNext}" enabled.last="false"/>
<s:Button id="backBt" label="Back" enabled="{hostComponent.permitBack}" enabled.first="false"/>
</s:HGroup>
</s:VGroup>

Resources