[flexcoders] First Custom Component

2009-11-23 Thread targetplanet
So I have created my first full custom component and would really like some 
feedback on it.  It replaces a List that uses ItemRenderers.  I hate the Flex 
List component, especially when using variableRowHeight and ItemRenderers.  I 
could never get it to work right, and the size changing scrollbar drove me 
nuts, so here is my ItemScroller component.  It is build fairly specific to the 
app I am building, but could be used elsewhere.  Basically it takes a 
dataprovider and ItemRenderer(Just another component really) and adds instances 
of the itemrender to a scrolling canvas contained in a VBox.  I added paging 
for really large datasets, and controls for that at the bottom.  So it would be 
really great to hear some suggestion on making this ItemScroller better, and 
feel free to use it if you want

So here is the code
?xml version=1.0 encoding=utf-8?
mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=init() 
horizontalScrollPolicy=off horizontalGap=1 verticalGap=3 
horizontalAlign=center
mx:Metadata
[Event(name=itemSelected, type=flash.events.Event)]
/mx:Metadata
mx:Script
![CDATA[
import mx.collections.ListCollectionView;
import mx.core.ScrollPolicy;
import mx.core.UIComponent;
import mx.core.Container;
import mx.collections.ICollectionView;
import mx.collections.XMLListCollection;
import mx.events.CollectionEvent;
import mx.collections.ArrayCollection;

private var _dataProvider:ListCollectionView;
private var _pageData:ArrayCollection = new 
ArrayCollection();
private var _pageSize:int = 10;
[Bindable]private var _currPage:int = 1;
[Bindable]private var _numPages:Number;
[Inspectable]
public var selectable:Boolean = false;
public var selectedItem:Object;

public var itemRenderer:Class;
private var isInit:Boolean = false;

private function init():void
{   
isInit = true;

if(_dataProvider != null){
setDP();

}

}

override public function validateSize(recursive:Boolean 
= false):void {
super.validateSize(recursive);
if (!initialized) return;
if (itemCanvas.height  
itemCanvas.measuredHeight) itemCanvas.verticalScrollPolicy = ScrollPolicy.ON;
else itemCanvas.verticalScrollPolicy = 
ScrollPolicy.OFF;
}

public function set 
dataProvider(val:ListCollectionView):void
{

if(val is XMLListCollection){
//trace(set dp XMLListCollection);
_dataProvider = val as 
XMLListCollection;
}else{
//trace(set dp ArrayCollection);
_dataProvider = val as ArrayCollection;
}

_dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE, setDP);
//_dataProvider.filterFunction = sortData;
setDP();

}

private function setDP(e:CollectionEvent = null):void
{
if(e != null){
//trace(setDP event +e.kind);
}
trace(dp length +_dataProvider.length);
if(_dataProvider.length  10){
controls.visible = true;
controls.height = 20;
_numPages = numberOfPages();
firstBtn.enabled = false;
prevBtn.enabled = false;
lastBtn.enabled = true;
nextBtn.enabled = true;

[flexcoders] localConnection doesn't work with layered sfws

2009-02-17 Thread targetplanet
I have a project that was done in AS2, and instead of porting it to
AS3(no budget..)I created an AS3 shell for all new features to be
loaded into, and am communicating between the as2 and as3 with
localConnection. This works fine, but the problem is since I want the
new content to appear to be part of the old, I need to 'float' the as3
swf over/above the as2 swf. I can do this no problem using divs and
css, but as soon as I do, the localConnection fails to connect in
either swf. Both the swfs function fine in this configuration, but no
localConnection. Any thoughts?



[flexcoders] What happened to Array.splice?

2008-03-14 Thread targetplanet
I was developing in FB3 beta, and I was adding items to an array using
splice.  it was adding the elements to the provided index, and if it
was greater then 0, it would add the empty elements as needed.  Then I
installed FB3 and it stopped added the needed preceding elements.  so
if the array was empty, even if I spesify the 3 index to put the item,
it just places it in the 0 index.
ugg
Russ



[flexcoders] Re: resizing a textArea to fit Text of the container.

2008-03-05 Thread targetplanet
--- In flexcoders@yahoogroups.com, Manish Jethani
[EMAIL PROTECTED] wrote:

 On 2/28/08, targetplanet [EMAIL PROTECTED] wrote:
 
   but it seems the textHeight can't be relied on, because it gives me
   crazy numbers that can't be right, like for 3 lines of text it says
   its 250.
   I am using htmlText, so I don't know if that matters.
 
 Do you have a lot of whitespace before and after those 3 lines of
 text? You could set 'condenseWhite' to true, that might help.
 
 Manish

I have set condenseWhite to true, but it is still returning a
ridiculous number: 5 lines of text it says is 510 heigh.  I set
condenseWhite to false, and it added 20 to the height, so I know the
condenseWhite is working some what. I am calling validateNow, so that
doesn't seem to be the issue.
 



[flexcoders] Re: I really don't know JS about Flex.. help with multirow tabbar

2008-02-05 Thread targetplanet
Thanks Tracy, I will check that out.  I was thinking of dumping the
tabbar and going with a flowbox component.  My only problem is how to
know when the dataProvider arrayCollection has changed.



[flexcoders] I really don't know JS about Flex.. help with multirow tabbar

2008-02-04 Thread targetplanet
ok so I am building an app that needs two tab bars, and I was under
the assumption that the tab bars would return to the next line if it
was too large for the space...hence the post title...I though for an
instance about extending the TabBar component to try and create a
multiline tabBar, but(see title).  So then I though ok I can create a
component that loops through my dataProvider array, assigning it to a
TabBar, checks the TabBar width against a set width, removes items
from the array until the bar is the right width, remove those items
from the original array, and repeat with a new TabBar.  So here is my
attempt.
Needless to say, it doesn't work, and I feel like I am no where near a
solution.  If anyone can help, or already has an exmple of a multiline
tabbar, that would be great.

Thanks,
Russ

I am trying to inplement this with mxml like:
is:MultiLineTab dataProvider={data} width=350/

package com.infusion.view.components
{

import flash.display.Sprite;

import mx.collections.ArrayCollection;
import mx.controls.TabBar;
//import mx.core.UIComponent;
import mx.events.CollectionEvent;
import mx.events.ItemClickEvent;

public class MultiRowTabs extends Sprite
{

public var _dataProvider:ArrayCollection = new 
ArrayCollection();

private var yPos:Number = 0;

public function MultiRowTabs()
{
trace(mrtInit);
//dataProvider = new ArrayCollection();

//_dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,
onChange);
}

private function click(e:ItemClickEvent):void{
trace(click);
}

private function onChange(dataProvider:ArrayCollection):void{

trace(dataProvider.toString());
var count:int = 0
var data:ArrayCollection = dataProvider;
while(count  dataProvider.length){
var dArray:Array = data.toArray();

var t:TabBar = new TabBar();
t.dataProvider = data;
t.addEventListener(ItemClickEvent.ITEM_CLICK, 
click);
if(t.width  width){
for(var i:int=data.length; i0 ; i--){
data.removeItemAt(i);
}
}
t.y = yPos;
addChild(t);
yPos += 30;
count += data.length;
dArray.splice(0,data.length);
data.source = dArray;
}
}

public function set dataProvider(dp:ArrayCollection):void{
//_dataProvider = dp;
trace(dp +dp.toString());
onChange(dp);
}
}
}



[flexcoders] mx:Model to VO

2007-04-26 Thread targetplanet
I read a tutorial last week about linking an mx:Model tag to a AS
Value Object class, and I can not find that tutorial again for the
life of me...
So does anyone know how this is done, or know where the tut is?
Thanks 
Russ



[flexcoders] Re: Coldfusion Path problems

2007-04-17 Thread targetplanet
Yea everything is were is suppose to be, I even tried moving stuff
around, and changing the path accourdingly, but that didn't work.

Russ

--- In flexcoders@yahoogroups.com, Muzak [EMAIL PROTECTED] wrote:

 Make sure that:
 com.benorama.phones.model.PhoneDAO
 
 is located at:
 /com/benorama/phones/model/PhoneDOA.cfc
 
 regards,
 Muzak
 
 - Original Message - 
 From: Russell Sprague [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Tuesday, April 17, 2007 8:26 PM
 Subject: [flexcoders] Coldfusion Path problems
 
 
 I am having problems with cfc paths when testing any Flex app that uses
  remoting and the cfc with absolute paths to themselves.
  It throws an error that it can not find the cfc.
  so take this line of code from Application.cfc in the Phones
example app:
  cfset application.phoneDAO = createObject(component,
  com.benorama.phones.model.PhoneDAO).init() /
  It will tell me it can not find the PhoneDAO component.
  If I make the path relative
  cfset application.phoneDAO = createObject(component,
  PhoneDAO).init() /
  it works.
  This is a problem with any cfc that has an absolute path reference.
  My Coldfusion dev box is separate from my workstation, so I
thought this
  was a network issue, because if I upload the app to my production
  server,  it will run fine.  But even when I test the app locally
on the
  Coldfusion dev box, it still throws the error.
  This is really bugging me, because I am trying to learn Cairngorm and
  with coldfusion connections, and most of the examples have cfc's that
  use absolute paths.  Also any app that is created using the
  Flex/Coldfusion wizard also creates cfc's with absolute paths.
  Any thoughts?
  Russ
 





[flexcoders] Sandbox Security help, please, god help!

2007-01-16 Thread targetplanet
I am building an app that will be run in the browser off of a cd.
(don't ask my why, for some reason the client has to have it in the
browser...) so basically all of the files are local.
The problem is I am using ExternalInterface, and no matter what I do,
it throws security error #2060, saying the swf can not access the html
file it is embeded in.  I tried a crossdomain file, tried setting
Security.allowDomain(*), I tried seting the allowScriptAccess in the
object param and embed tags on the html page to always, and I added
allowNetworking, no matter what it throws the error.  The only time it
doesn't throw the error is if I select the html file in flex builder,
and say open in browser, then it runs fine.
please give me an answer other then this can't be done...

Thanks
Russ