[flexcoders] Using Server Stored Images In An Air Application?

2010-03-20 Thread James
Is there any way to display server stored images within an Air application?



[flexcoders] Re: Photo Viewer Sample App

2010-03-20 Thread cjsteury2
Amy I just moved the changePolicy event for createComponentsfromDescriptors() 
to the resultHandler of the Photoservice, set the creationPolicy on Viewstack 
to none and it works like a charm.. thanks for putting me on the right track.
I anyone else wants to use the Carousel as the only child of the Viewstack for 
this (very cool) app I hope they find this trick useful.

CS

--- In flexcoders@yahoogroups.com, "cjsteury2"  wrote:
>
> Hi Again Amy,
> Realizing that wasn't right I am now just getting a blank screen .. I am 
> still working on it so I'll keep you posted.
> 
> package samples.photoviewer
> {
>   import flash.events.*;
>   
>   import mx.collections.ArrayCollection;
>   import mx.collections.IViewCursor;
>   import mx.events.CollectionEvent;
>   import mx.rpc.events.ResultEvent;
>   import mx.rpc.http.HTTPService;
>   import mx.utils.ArrayUtil;
> 
>   public class PhotoService
>   {
>   private var service:HTTPService;
>   public var app:PhotoViewer;
> 
> [Bindable]
>   public var galleries:ArrayCollection;
> 
>   public function PhotoService(url:String)
>   {
>   service = new HTTPService();
>   service.url = url;
>   service.addEventListener(ResultEvent.RESULT, 
> resultHandler);
>   service.send();
>   galleries = new ArrayCollection([]);
>   
> galleries.addEventListener(CollectionEvent.COLLECTION_CHANGE, changePolicy);
>   }
> 
>   private function resultHandler(event:ResultEvent):void
>   {
>   var result:ArrayCollection = event.result.galleries.gallery 
> is ArrayCollection
>   ? event.result.galleries.gallery as ArrayCollection
>   : new 
> ArrayCollection(ArrayUtil.toArray(event.result.galleries.gallery));
>   var temp:ArrayCollection = new ArrayCollection();
>   var cursor:IViewCursor = result.createCursor();
>   while (!cursor.afterLast)
>   {
>   temp.addItem(new Gallery(cursor.current));
>   cursor.moveNext();
>   }
>   galleries = temp;
>   }
>   
>   private function changePolicy():void {
>   app = new PhotoViewer();
>   app.views.createComponentsFromDescriptors();
> }
>   }
> }
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Amy"  wrote:
> >
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "cjsteury2"  wrote:
> > >
> > > Hey Pete, 
> > > 
> > > I see you had the same issue I am experiencing today.. and its been 1/2 a 
> > > day so far of pulling out hair.
> > > 
> > > Do you remember how you solved this 3 years ago???
> > 
> > What you have is a race condition where the reset() function in Carousel.as 
> > assumes that you always have a valid Carousel, but of course the gallery 
> > property is beling set by a BindSetter that doesn't have anything to bind 
> > to until the PhotoService resultHandler has populated the photoService's 
> > galleries property.
> > 
> > If you want to actually fix it, one way is to go into the PhotoService code 
> > and initialize the galleries variable to new ArrayCollection([new 
> > ArrayCollection)]);
> > 
> > Not the cleanest solution, but that's kind of what you get when the code is 
> > too dependent on binding.  The Carousel component unfortunately doesn't 
> > _know_ it's dependent on binding, so it isn't able to swallow up errors 
> > related to being passed in junk values via binding.
> > 
> > If you want to just work around it, then you can just listen for 
> > COLLECTION_CHANGE on photoService.galleries, and switch the ViewStack pane 
> > once the result is received.
> > 
> > HTH;
> > 
> > Amy
> >
>




[flexcoders] Re: Photo Viewer Sample App

2010-03-20 Thread cjsteury2
Hi Again Amy,
Realizing that wasn't right I am now just getting a blank screen .. I am still 
working on it so I'll keep you posted.

package samples.photoviewer
{
import flash.events.*;

import mx.collections.ArrayCollection;
import mx.collections.IViewCursor;
import mx.events.CollectionEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
import mx.utils.ArrayUtil;

public class PhotoService
{
private var service:HTTPService;
public var app:PhotoViewer;

[Bindable]
public var galleries:ArrayCollection;

public function PhotoService(url:String)
{
service = new HTTPService();
service.url = url;
service.addEventListener(ResultEvent.RESULT, 
resultHandler);
service.send();
galleries = new ArrayCollection([]);

galleries.addEventListener(CollectionEvent.COLLECTION_CHANGE, changePolicy);
}

private function resultHandler(event:ResultEvent):void
{
var result:ArrayCollection = event.result.galleries.gallery 
is ArrayCollection
? event.result.galleries.gallery as ArrayCollection
: new 
ArrayCollection(ArrayUtil.toArray(event.result.galleries.gallery));
var temp:ArrayCollection = new ArrayCollection();
var cursor:IViewCursor = result.createCursor();
while (!cursor.afterLast)
{
temp.addItem(new Gallery(cursor.current));
cursor.moveNext();
}
galleries = temp;
}

private function changePolicy():void {
app = new PhotoViewer();
app.views.createComponentsFromDescriptors();
}
}
}




--- In flexcoders@yahoogroups.com, "Amy"  wrote:
>
> 
> 
> --- In flexcoders@yahoogroups.com, "cjsteury2"  wrote:
> >
> > Hey Pete, 
> > 
> > I see you had the same issue I am experiencing today.. and its been 1/2 a 
> > day so far of pulling out hair.
> > 
> > Do you remember how you solved this 3 years ago???
> 
> What you have is a race condition where the reset() function in Carousel.as 
> assumes that you always have a valid Carousel, but of course the gallery 
> property is beling set by a BindSetter that doesn't have anything to bind to 
> until the PhotoService resultHandler has populated the photoService's 
> galleries property.
> 
> If you want to actually fix it, one way is to go into the PhotoService code 
> and initialize the galleries variable to new ArrayCollection([new 
> ArrayCollection)]);
> 
> Not the cleanest solution, but that's kind of what you get when the code is 
> too dependent on binding.  The Carousel component unfortunately doesn't 
> _know_ it's dependent on binding, so it isn't able to swallow up errors 
> related to being passed in junk values via binding.
> 
> If you want to just work around it, then you can just listen for 
> COLLECTION_CHANGE on photoService.galleries, and switch the ViewStack pane 
> once the result is received.
> 
> HTH;
> 
> Amy
>




Re: [flexcoders] Re: Photo Viewer Sample App

2010-03-20 Thread Craig Steury
Hi Amy,
Thanks for the help.
I don't really want the other viewstack children involved.  When they are
the carousel seems to initiate correctly.  So I thought I'd set
creationPolicy to none for viewstack and initiate a
createComponentsFromDescriptors.  This is not working though as I get a null
error at the galleries.addEventListener CollectionChange Event.. here is
what the photoservice code looks like.
Any ideas where I go from here?

public class PhotoService
{
private var service:HTTPService;
private var app:PhotoViewer;

[Bindable]
public var galleries:ArrayCollection;

public function PhotoService(url:String)
{
service = new HTTPService();
service.url = url;
service.addEventListener(ResultEvent.RESULT, resultHandler);
service.send();
galleries = new ArrayCollection([]);
galleries.addEventListener(CollectionEvent.COLLECTION_CHANGE,
app.views.createComponentsFromDescriptors);
}

private function resultHandler(event:ResultEvent):void
{
var result:ArrayCollection = event.result.galleries.gallery is
ArrayCollection
? event.result.galleries.gallery as ArrayCollection
: new
ArrayCollection(ArrayUtil.toArray(event.result.galleries.gallery));
var temp:ArrayCollection = new ArrayCollection();
var cursor:IViewCursor = result.createCursor();
while (!cursor.afterLast)
{
temp.addItem(new Gallery(cursor.current));
cursor.moveNext();
}


galleries = temp;


}
}
}










On Sat, Mar 20, 2010 at 5:13 PM, Amy  wrote:

>
>
>
>
> --- In flexcoders@yahoogroups.com ,
> "cjsteury2"  wrote:
> >
> > Hey Pete,
> >
> > I see you had the same issue I am experiencing today.. and its been 1/2 a
> day so far of pulling out hair.
> >
> > Do you remember how you solved this 3 years ago???
>
> What you have is a race condition where the reset() function in Carousel.as
> assumes that you always have a valid Carousel, but of course the gallery
> property is beling set by a BindSetter that doesn't have anything to bind to
> until the PhotoService resultHandler has populated the photoService's
> galleries property.
>
> If you want to actually fix it, one way is to go into the PhotoService code
> and initialize the galleries variable to new ArrayCollection([new
> ArrayCollection)]);
>
> Not the cleanest solution, but that's kind of what you get when the code is
> too dependent on binding. The Carousel component unfortunately doesn't
> _know_ it's dependent on binding, so it isn't able to swallow up errors
> related to being passed in junk values via binding.
>
> If you want to just work around it, then you can just listen for
> COLLECTION_CHANGE on photoService.galleries, and switch the ViewStack pane
> once the result is received.
>
> HTH;
>
> Amy
>
>  
>


[flexcoders] Using An Array Collection Produced From XML In Conjunction With Shared Object

2010-03-20 Thread James
I have an old app which allows the user to drag items between two tilelists and 
then save the contents of both tilelists by clicking a save button using the 
sharedObject method. The tilelists are populated by array collections defined 
in the app. I want to change this so that the tilelists are instead populated 
by an array collection which I've retrieved from a remote xml file via http 
request but I can't get this to work. Basically I need to replace both the 
predefined array collections profile1NewsAndSportaddLinksFullAC and 
profile1NewsAndSportaddLinksAC with my xml/httprequest produced newsAC array 
collection and still make the tilelists saveable. Can anyone help me out? 
Here's the code:-


http://www.adobe.com/2006/mxml"; layout="absolute" 
creationComplete="newsService.send(); initprofile1NewsAndSportSO()">








http://www.coolvisiontest.com/getnews.php"/> 


















[flexcoders] Re: Photo Viewer Sample App

2010-03-20 Thread Amy


--- In flexcoders@yahoogroups.com, "cjsteury2"  wrote:
>
> Hey Pete, 
> 
> I see you had the same issue I am experiencing today.. and its been 1/2 a day 
> so far of pulling out hair.
> 
> Do you remember how you solved this 3 years ago???

What you have is a race condition where the reset() function in Carousel.as 
assumes that you always have a valid Carousel, but of course the gallery 
property is beling set by a BindSetter that doesn't have anything to bind to 
until the PhotoService resultHandler has populated the photoService's galleries 
property.

If you want to actually fix it, one way is to go into the PhotoService code and 
initialize the galleries variable to new ArrayCollection([new 
ArrayCollection)]);

Not the cleanest solution, but that's kind of what you get when the code is too 
dependent on binding.  The Carousel component unfortunately doesn't _know_ it's 
dependent on binding, so it isn't able to swallow up errors related to being 
passed in junk values via binding.

If you want to just work around it, then you can just listen for 
COLLECTION_CHANGE on photoService.galleries, and switch the ViewStack pane once 
the result is received.

HTH;

Amy



[flexcoders] Re: Scale 9

2010-03-20 Thread turbo_vb
Scale 9 has nothing to do with the position of the image.  You would use the 
normal properties for that ( top, bottom, left, right ).  What scale 9 defines 
is the portion of the image to stretch when the dimensions of the image are 
changed to be bigger than the original image size.  So, if you look at the 
sample in your link, the blue rectangle in the very center is what will be 
stretched.  The rest of the image ( the fancy corners ) will remain unchanged.

-TH

--- In flexcoders@yahoogroups.com, "hgnowhg"  wrote:
>
> I'm very confused on using scale 9 to position images in flex. I am using 
> this link: 
> http://www.adobe.com/devnet/flex/quickstart/embedding_assets/#EmbeddingImagesScale9
> 
> They have a width of 266 and height of 55...I get where the 266 and 55 come 
> into play in the embed code:
> scaleGridTop="55", scaleGridBottom="137",  scaleGridLeft="57", 
> scaleGridRight="266"
> 
> But where do the 57 and 137 come from?
>




[flexcoders] PhotoView App Problem

2010-03-20 Thread cjsteury2
heres my problem.

If I try to modify this app so Carousel is default in Viewstack (move to top)...

http://www.adobe.com/devnet/flex/samples/photo_explorer/

Then the Carousel component calls a resize="carousel.reset()"

event on app load which throws an error 1/2 the time referencing null object...

the resize events fits the images on the screen...  how can I load this  
carousel.reset event so that it waits for viewstack to build... or do I set the 
creationPolicy different than it is .. 'queded'

Its a problem.

public function reset():void
{
var selected:int = gallery.selected;
var appWidth:int = Application.application.width;
var compHeight:int = 
(Application.application.height)*.90;

picDimension = new Array(9);
picPos = new Array(9);

picDimension[0] = appWidth*.05;
picDimension[1] = appWidth*.05;
picDimension[2] = appWidth*.10;
picDimension[3] = appWidth*.15;
picDimension[4] = appWidth*.7;
picDimension[5] = appWidth*.15;
picDimension[6] = appWidth*.10;
picDimension[7] = appWidth*.05;
picDimension[8] = appWidth*.05;

picPos[0] = new Point(appWidth*(-.075) - 109, 
(compHeight - picDimension[0])/2);
picPos[1] = new Point(appWidth*(-.025) - 101, 
(compHeight - picDimension[1])/2);
picPos[2] = new Point(appWidth*.025 - 93, (compHeight - 
picDimension[2])/2);
picPos[3] = new Point(appWidth*.125 - 85, (compHeight - 
picDimension[3])/2);
picPos[4] = new Point(appWidth*.275 - 77 , (compHeight 
- picDimension[4])/2);
picPos[5] = new Point(appWidth*.675 + 112, (compHeight 
- picDimension[5])/2);
picPos[6] = new Point(appWidth*.825 + 120, (compHeight 
- picDimension[6])/2);
picPos[7] = new Point(appWidth - appWidth*(.025) + 80, 
(compHeight - picDimension[7])/2);
picPos[8] = new Point(appWidth + appWidth*(.025) + 88, 
(compHeight - picDimension[8])/2);

for (var i:int=0; i < 9; i++)
{
var image:CarouselImage = getChildAt(i) as 
CarouselImage;
var pos:int = selected + i - 4;

if (pos >= 0 && pos < gallery.photos.length)
{
image.width = picDimension[i];
image.height = picDimension[i];
image.x = picPos[i].x;
image.y = picPos[i].y;
image.source = "galleries/" + 
gallery.photos.getItemAt(pos).source;
image.visible = true;
}
else
{
image.visible = false;
}
}
}




[flexcoders] Re: Photo Viewer Sample App

2010-03-20 Thread cjsteury2
Hey Pete, 

I see you had the same issue I am experiencing today.. and its been 1/2 a day 
so far of pulling out hair.

Do you remember how you solved this 3 years ago???


Craig




--- In flexcoders@yahoogroups.com, P Smith  wrote:
>
> The "Photo Viewer" Sample App has a ViewStack with 3 views:   ...>, , .
> 
> When I move  to the top of the stack, on execution it 
> throws an:  Error #1009: Cannot access a property or method of a null object 
> reference. 
> 
> Poking around with the debugger the problem is that the property gallery =  
> null.  
> 
> It all works fine as originally written.  That is when  is 
> not the first view in the stack.  The default app PhotoViewer.mxml uses 
> databinding for passing in gallery="{gallery}" to each of the 3 views.
> 
> Can anyone help out suggesting why  only fails when it is 
> first view in the stack?
> 
> fyi ...
> 
> The "Photo Viewer" Sample App is easy to install via the Flex Builder 2 "Flex 
> Start Page"
> (Install sequence:  Main Menu -> Help -> Flex Start Page -> More installed 
> samples -> Photo Viewer -> Open Project)
> 
> Because ResourceBundle are used, you might encounter the (annoying) bug 
> 174788 (as documented in TechNote at www.adobe.com/go/4a146409) which 
> requires "In Flex Builder, clean the project in order to remove the error."
> 
> I really would like to get "Photo Viewer" Sample App working with 
>  as the default view.  If anyone can help me figure out how 
> to do that, I would appreciate it.
> 
> In debugging this I have gotten as far as ...
> When the Error #1009 occurs, FB2 opens Carousel.as pointing to the first 
> statement in method reset() which references:  gallery.selected
> 
> Using a breakpoint, the debugger's Variables panel shows"gallery=null".
> 
> I then modified reset() to include "if ( gallery != null )" in 2 places.  
> 1) around:  var selected:int = gallery.selected;
> 2) around the entire loop:  for (var i:int=0; i < 9; i++)
> 
> This clears the #1009 error, but the Variables window continues to show 
> "gallery=null".  Only if I then navigate to either  or 
>  before navigating back to   does the 
> databinding finally set the gallery property and  works.
> 
> Pete
> 
> 
> 
> 
>  
> 
> Sponsored Link
> 
> $200,000 mortgage for $660/ mo - 
> 30/15 yr fixed, reduce debt - 
> http://yahoo.ratemarketplace.com
>




[flexcoders] Gumbo: Can't Interact with children of an ItemRenderer

2010-03-20 Thread mlharrisn
I thought this would be pretty easy but I'm running into all sorts of problems 
with this. I have an ItemRenderer with a an image and two labels. I want to 
assign separate mouse events to the image and two labels. It seems like the 
item renderer is treated like a single interactive piece and I haven't found a 
way to override that. I couldn't even disable the default rollover effect so I 
had to style the rollOverColor to match my background.

Can anyone provide a solution?


http://ns.adobe.com/mxml/2009"; 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:ns="library://ns.adobe.com/flex/mx"
buttonMode="true" useHandCursor="true"
mouseChildren="true">







   















[flexcoders] Euros/Dollars conversion tools

2010-03-20 Thread Christophe
Hello, 

I am searching a system to receive with a script the Euro/Dollars conversion 
every day. 

How to do this with Flex? 

Thank you,
Christophe, 



[flexcoders] Scale 9

2010-03-20 Thread hgnowhg
I'm very confused on using scale 9 to position images in flex. I am using this 
link: 
http://www.adobe.com/devnet/flex/quickstart/embedding_assets/#EmbeddingImagesScale9

They have a width of 266 and height of 55...I get where the 266 and 55 come 
into play in the embed code:
scaleGridTop="55", scaleGridBottom="137",  scaleGridLeft="57", 
scaleGridRight="266"

But where do the 57 and 137 come from?



[flexcoders] Regarding CollapsiblePanel's minimize and restore Events

2010-03-20 Thread binoop_cv
In mxml we can specify the minimize and restore Events as



My question is how can we determine whether its an "minimize" or "restore" 
events using actionscript?

In the case of datagrid we can specify addEventListener as 
dg.addEventListener(DataGridEvent.ITEM_EDIT_BEGIN, checkFieldCanBeEdited);

So in the ITEM_EDIT_BEGIN, it will call the function checkFieldCanBeEdited.

How we can add "minimize" and "restore" events of CollapsiblePanel   like the 
above?

Thanks much,
Binoop



[flexcoders] Is it possible to change the datatip "dot" style/position on a chart?

2010-03-20 Thread s_grollins
Hi everyone,

I have a column chart and I want to reposition and change the style of the 
datatip "dot" - the datatip itself I can change by setting the datatip renderer 
- but what about the positioning of that dot?

For an example view the following: 
http://livedocs.adobe.com/flex/3/html/help.html?content=charts_displayingdata_01.html#332245
 - the little dot that comes at the end of the bar in the first chart that is.

Thanks in advance to anyone that can help me with this!

-Steven