Flex (4) Repeater control overflows contrainer - actionscript

I have a repeater control in an AIR application, that gets data dynamically. The repeater is inside a panel:
<s:Panel top="50" bottom="10" left="10" right="10">
<mx:VBox>
<mx:Repeater id="FeedItemsRptr" dataProvider="{Story_Collection}" height="300">
<s:Label text="{FeedItemsRptr.currentItem.storyTitle}" />
<s:RichText text="{FeedItemsRptr.currentItem.storyDesc}" />
<mx:HRule width="100%"/>
</mx:Repeater>
</mx:VBox>
</s:Panel>
However, when the data is bound to the control, the repeater text flows out of the panel container instead of getting scrollbars.
I have tried to encapsulate the repeater inside an to the same effect, while is even more unpredictable.
Any idea on how to tame the repeater?
http://i.stack.imgur.com/WFspk.png
you can find more on what I wanted to do by going to : http://aphatak.blogspot.com/2010/11/and-take-that-too-times-of-india.html
I have kept some screenshots, flash builder source and compiled bin there; thanks for your help!

A solution that seems to be working is wrapping up the VBox in a spark:Scroller component like below:
<s:Panel width="100%" height="100%" top="50" bottom="10"
left="10" right="10" title="{FeedItemsRptrCont.height}">
<s:Scroller width="100%" height="100%">
<s:Group width="100%" height="100%">
<mx:VBox id="FeedItemsRptrCont" width="100%" height="100%">
<mx:Repeater id="FeedItemsRptr" width="100%" height="100%" dataProvider="{Story_Collection}">
<s:Label text="{FeedItemsRptr.currentItem.storyTitle}" />
<s:RichText text="{FeedItemsRptr.currentItem.storyDesc}" />
<mx:HRule width="100%" />
</mx:Repeater>
</mx:VBox>
</s:Group>
</s:Scroller>
</s:Panel>
However, what you want to be doing seem to be something that a spark:List would do better than a repeater.

Related

SVG Vector Effect

I am trying to define a fixed stroke width into my SVG, similar to this thread.
In my devenv (VS 2017) I am running Edge and the project is targeting .net 4.6.1
The SVG is defined as:
<svg version="1.1"
baseProfile="full"
width="100%" height="Auto"
viewBox="0 0 #sheet.SheetShape.Bounds.Width #sheet.SheetShape.Bounds.Height"
xmlns="http://www.w3.org/2000/svg">
<rect width="100%" height="100%" stroke="red" fill="white" />
#foreach (var cut in sheet.SheetCuts)
{
<line vector-effect="non-scaling-stroke" stroke-width="2" stroke="black" stroke-dasharray="5, 5" x1=#cut.Start.X y1=#cut.Start.Y x2=#cut.End.X y2=#cut.End.Y />
}
The vector-effect property is not recognized by VS intellisense and when the code runs nothing special happens.
What should be wrong?

Fallback for SVG fill image source

I am looking into using an image as an SVG fill. I am currently using the following SVG markup:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="logo" x="0px" y="0px" viewBox="0 0 200 25" enable-background="new 0 0 0 0" xml:space="preserve">
<defs>
<pattern id="bg" patternUnits="userSpaceOnUse" width="300" height="25">
<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="..." preserveAspectRatio="xMidYMid slice"></image>
</pattern>
</defs>
<g class="graphic">
<path d="..."></path>
</g>
(I have left some details out ("...") of which I am sure are not relevant to my issue.)
In CSS, I use the following code to append the pattern ID. Pls see below:
.default-header .site-name svg.logo .graphic {
fill:url(#bg);
}
I've already done some digging and found out that this technique (images as SVG background) isn't supported in FireFox and iOS Safari. Therefore I used the following "fall-back" method in CSS:
.default-header .site-name svg.logo .graphic {
fill:#ddd;
}
#supports (-webkit-appearance:none) {
.default-header .site-name svg.logo .graphic {
fill:url(#bg);
}
}
The above code works, EXCEPT for iOS 8/9's Safari. So my issue is mainly that I don't know how to target those non-supporting browsers, which I'm sure there are more of than I am currently testing. SO... I decided to use Modernizr to look for support, but I can't seeem to find an appropriate, representational way of checking if this SVG technique is supported. In other words, on this page: https://modernizr.com/download?setclasses, I can't find the browser feature appropriate for my issue.
I hope somebody knows what direction I could best look into or better yet, has some experience with this technique, which I still think is so awesome (if it works).
Thanks in advance guys!
I found a solution by using a different approach in markup. Instead of using defs and gs, I used the following markup to achieve the same effect:
<svg id="graphic" width="300" height="40">
<!-- Graphic: Styling (inline as FF fix) -->
<style> svg image { clip-path:url(#clipping); } </style>
<!-- Clip Path -->
<clipPath id="clipping">
<!-- this might as well be any type of path -->
<text id="graphicText" x="0" y="37">My Text</text>
</clipPath>
<!-- Image -->
<image id="graphicImage" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{img_url}" width="300" height="300" x="0" y="-120px"></image>
</svg>
I used CSS styling for the text itself.
Hope this helps someone!

Banner not shown

I started to use advertising control, but I'm going crazy trying to let it work.
I copied PivotPage.xaml from Microsoft Ad Control Sample and made it the starting page in my app, but ad control is not shown (I'm not able to see banner); if I try to run Microsoft app, banner is shown.
So I registered my app on pubCenter and I got an appId and a unitId and tried to use them in my app, but the result is the same: no banner!!
If I try to use my ids in Microsoft app, test banner is shown.
Why using Microsoft example I'm able to see banner and using same page in my app I can't?
Why using my ids, Microsoft app does not show correct banner?
Here is XAML
<!--Pivot Control-->
<controls:Pivot Grid.Row="0" Title="Ad Control Sample">
<!--Pivot item one-->
<controls:PivotItem Header="piv 1">
</controls:PivotItem>
<!--Pivot item two-->
<controls:PivotItem Header="piv 2">
</controls:PivotItem>
<!--Pivot item three-->
<controls:PivotItem Header="piv 3">
</controls:PivotItem>
</controls:Pivot>
<StackPanel Grid.Row="1" VerticalAlignment="Bottom" >
<TextBlock Text="This is the same ad."
TextWrapping="Wrap"
HorizontalAlignment="Stretch"
TextAlignment="Center" />
<my:AdControl Name="adControl1"
ApplicationId="test_client"
AdUnitId="Image480_80"
HorizontalAlignment="Center"
Width="480" Height="80" />
</StackPanel>
I finally managed to solve my problem and I want to share solution.
I add an event handler for ErrorOccurred on ad control and reading Microsoft.Advertising.AdErrorEventArgs e I realized that my manifest (WMAppManifest.xml) was missing
<Capability Name="ID_CAP_IDENTITY_USER" />
<Capability Name="ID_CAP_MEDIALIB" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />

Silverlight Host App only showing loading image

Im attempting to use Silverlight and MVC together. After creating a simple Silverlight application I attempted to view it using the MVC host application (using the provided aspx and html pages). The issue is that when I view the page all I see is the Loading image (with a 100% value) and that is all. It never displays my app!
Here is the html for the aspx page:
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/MVCSilverlight.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40818.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
And here is the xaml for the application:
<UserControl x:Class="MVCSilverlight.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d"
d:DesignHeight="500" d:DesignWidth="500">
<Canvas x:Name="LayoutRoot" Background="Crimson">
<TextBlock Text="Hello World" ></TextBlock>
</Canvas>
</UserControl>
Everything else in the application is standard code (code that was generated when I created the project). Has someone seen this issue before? Is there something that I'm missing? I'm very new to both technologies to any info will be very helpful.
When you run the app check that VS has attached to the browser process for Silverlight debugging (not Script).
Also check your App.xaml.cs contains:-
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
The loading splash screen will remain in place whilst the RootVisual remains unset. So either the code just doesn't set it or an error is occuring (and for some reason your not being alerted of the error) so that code never reaches the assignment of RootVisual.
Also get yourself a the free HTTP debugging tool called Fiddler so you can trace all the actual HTTP conversations, perhaps the xap isn't being downloaded at all for some reason. In fact that would be my guess, the MVC routing might be doing something undesirable with "ClientBin/MVCSilverlight.xap".

What lightboxes work inside Firefox extensions?

I want to use a lightbox like Shadowbox or similar inside a Firefox extension. But Shadowbox causes Javascript errors like this:
Error: document.write is not a function
Source file: chrome://iframe/content/shadowbox/shadowbox.js
Line: 1557
Which lightbox supports IFRAMEs and will run correctly inside an extension (ie. added to the overlay XUL)?
Which kind of feature are you looking for?
Is it that you can popup "overlays" over the content? The XUL equivelant of overlays are panels. You can also easily add an iframe to XUL by using the HTML namespace. I would not recommend it though, but use some simple javascript to change the content of the panel instead.
You can also try with stack. Here is a small example :
<?xml version="1.0"?>
<!DOCTYPE window PUBLIC "-//MOZILLA//DTD XUL V1.0//EN" "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<window id="test"
title="test"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:svg="http://www.w3.org/2000/svg">
<stack>
<hbox>
<vbox>
<hbox>
<label value="123"/>
</hbox>
<hbox>
<label value="456"/>
</hbox>
<html:iframe style="width: 800px; height: 400px;" src="http://www.google.com"/>
</vbox>
</hbox>
<vbox style="position: absolute;opacity: 0.5;">
<html:iframe style="position: absolute; top: 100px; left: 100px; width: 500px;" src="http://www.google.com"/>
</vbox>
</stack>
</window>
Quite possibly none. Lightboxes are meant to work with (X)HTML, not XUL.

Resources