[flexcoders] StyleManager.loadStyleDeclarations causes SecruityError

2008-01-15 Thread Lachlan Cotter

Hi Flexcoders,



Can anyone help me with an apparent sandbox issue?

I'm attempting to load an SWF at runtime using the StyleManager.

StyleManager.loadStyleDeclarations(url);

The URL is on a remote web sever and I am running the code from a  
local trusted SWF. I understand this should be enough to allow Flash  
player to download the asset. However, this results in the following  
error being thrown from somewhere in the ModuleManager.


Error: Unable to load style(SWF is not a loadable module): http:// 
mysever.com/my path to the .swf


I also tried using the 'trustedContent' argument to  
loadStyleDeclarations


StyleManager.loadStyleDeclarations(url, true, true);

However, this seems to result in a different error:

SecurityError: Error #2142: Security sandbox violation: local SWF  
files cannot use the LoaderContext.securityDomain property.


The server does have a crossdomain policy file:

?xml version=1.0?
!DOCTYPE cross-domain-policy SYSTEM http://www.macromedia.com/xml/ 
dtds/cross-domain-policy.dtd

cross-domain-policy
  allow-access-from domain=* /
/cross-domain-policy

But Flash player doesn't seem to be loading it. According to Safari's  
Activity monitor.


The SWF file does exist. I downloaded in a browser it and loaded it  
locally through the StyleManager without problems.


Can anyone shed some light on this?



Many thanks,
Lach

smime.p7s
Description: S/MIME cryptographic signature


[flexcoders] Loading classes at runtime from RSLs, SWCs etc.

2007-12-13 Thread Lachlan Cotter

Hi All,




I was wondering if someone can offer some advice on dynamic loading  
of classes at runtime.


What I would like to achieve is to create a library of view classes  
(effect classes to be specific) which can by dynamically loaded into  
a Flex application at run time. I don't want to re-compile the main  
application when new classes become available.


All the classes will conform to an abstract interface.

Ideally, when new classes are available, I want to compile them into  
SWC files and place them in a directory on the server so that next  
time the Flex application is run, it can detect the available classes  
and present a list that the user can choose from.


I've got the idea you can do something like this with SWC files  
published from Flash CS3.


Can someone point me toward some resources or offer some tips that  
might help me ask a better question.





Cheers,
Lach

smime.p7s
Description: S/MIME cryptographic signature


[flexcoders] Embedded SWFs and Fonts

2007-12-03 Thread Lachlan Cotter

Hi Flexcoders,




I've got a slightly obscure objective concerning Embedded SWFs and  
Fonts in ActionScript 3 Projects. Basically I want to be able to  
create several SWFs (probably in Flash) which can be embedded in  
ActionScript 3 projects and styled. I.e. I want to be able to change  
the fonts used in the SWF.


The tricky part is, I don't want to embed the fonts directly inside  
the embedded SWFs — I want to embed them in the parent application so  
they can be shared across the embedded SWFs. The goal is to keep all  
SWFs as small as possible.


Can this be done with SWFs created in Flash 8? What about Flash 9 CS 3?




Cheers,
Lach

smime.p7s
Description: S/MIME cryptographic signature


[flexcoders] Re: Scaling a TextArea without reflowing the text

2007-11-15 Thread Lachlan Cotter
Excellent. Problem solved. Thanks Dan.

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

 textField.antiAliasType = AntiAliasType.NORMAL;
 
 - Dan Freiman



[flexcoders] Scaling a TextArea without reflowing the text

2007-11-14 Thread Lachlan Cotter

Hi Flexcoders,



Does anybody know the secret to scaling a multi-line text container  
(e.g. a TextArea) while preserving the flow (line wrapping) of the text?


I want to be able to 'zoom in' on a TextArea while keeping the text  
flow the the same as it was.


I would have expected that when I set scaleX and scaleY properties on  
the TextArea that the whole thing grows bigger while keeping the text  
flow essentially the same, but this isn't the case.


There appears to be some kind of rounding error or the text isn't  
scaled in proportion because it jitters all over the place and the  
line wrapping changes.


I have tried scaling the TextArea directly, a parent of the TextArea,  
and even pulling out the TextArea's internal TextField and scaling  
that. All have the same results. I've also tried with embedded fonts.


Does anyone know how to make the text behave itself?

Example code is attached.



Cheers and many thanks to all,

Lach



?xml version=1.0 encoding=utf-8?

mx:Application
xmlns:mx=http://www.adobe.com/2006/mxml;
xmlns:view=com.bremy.print.view.*
layout=absolute 

mx:HSlider horizontalCenter=0 y=100
minimum=0.5 maximum=2 liveDragging=true
change=scaleText(event) /

mx:VBox id=box horizontalCenter=0 verticalCenter=0
horizontalAlign=center verticalGap=20 
backgroundColor=white

mx:TextArea id=area
paddingLeft=10 paddingRight=10
width=300 height=300
text={text} /

/mx:VBox



mx:Script
![CDATA[
import mx.events.SliderEvent;

protected function scaleText (event:SliderEvent):void {

area.scaleX = event.value;
area.scaleY = event.value;

}


			private const text:String = Duis, velit nulla, accumsan magna,  
veniam.  +

Consequat nibh sed vero erat dolore ea 
aliquam duis at exerci  +
	ullamcorper dolor. Velit ut iusto, enim consequat vulputate  
enim  +
	enim facilisi autem nulla. Amet accumsan lobortis, ut eum,  
vulputate,  +
	vero blandit et dolore consequat veniam quis duis wisi vero.  
Ex,  +
	dignissim delenit commodo, hendrerit molestie et augue odio ex  
nisl  +
	tation odio iriure veniam eum. Luptatum consequat autem.  
Consequat  +
	molestie facilisi qui nulla. In accumsan vero, ut. Et,  
vulputate,  +
	consequat, blandit, aliquip dolore, ipsum veniam dolore duis  
delenit  +

vero dolore dignissim accumsan.

]]
/mx:Script

/mx:Application



smime.p7s
Description: S/MIME cryptographic signature


Re: [flexcoders] Flex Builder issues with large projects

2007-08-30 Thread Lachlan Cotter

Hi Tracy,



Thanks for those suggestions. Unfortunately, the vast majority of the  
code base is required for all products, and breaking it up as runtime  
shared libraries hasn't worked very well. Your second suggestion is  
very interesting. I suppose you need to be running Flex Builder as an  
eclipse plug-in to go this route?


I've also read in the Flex documentation that using Modules can help  
to optimise compilation, as recompilation is limited to the effected  
module. Can anyone comment on real world experience with this approach?




Cheers,
Lach


On 28/08/2007, at 3:00 PM, Tracy Spratt wrote:

Can you logically break the project up into several smaller  
projects?  This way, you can close the projects you are not  
actively working on, which speeds up the compilation significantly.




Also some folks use the command line compiler and Ant, and report  
better results(I use FB exclusively so far).




Tracy




smime.p7s
Description: S/MIME cryptographic signature


[flexcoders] Flex Builder issues with large projects

2007-08-28 Thread Lachlan Cotter

Hi List,



I'm having a lot of trouble with Flex Builder on a large project I'm  
working on and would really appreciate some advice if anyone has  
found themselves in a similar situation.


The particular project I'm working on is approaching 30,000 lines of  
code and also includes a fair bit of embedded assets in the form of  
skins and images etc. I am building several different products from  
the same class library.


The first problem is that compilation time is far too long. Typically  
30 seconds or more even after very minor changes to the source code,  
about 2 minutes for a clean build. It has become very difficult to do  
testing in particular as the delay for compilation break up workflow  
too much.


I thought I would try to solve this problem by using RSL from Flex  
Library Projects as mentioned here:


http://flexblog.faratasystems.com/?p=117

This does seem to greatly improve the compilation times, but has  
cased no end of problems with Flex Builder. Flex Builder seemed to  
become corrupted, would not allow me to add SWC files to projects,  
and even started to have problems rendering the user interface. I did  
a complete uninstall and reinstall of Flex Builder, but continued to  
have problems loading the projects.


Flex builder takes a long time to start up, reports stack overflow  
errors, or simply will not start unless I remove the projects.


I also tried using the Flex Builder 3 Beta, but also ran into  
[different] problems which prevented me from loading and compiling  
the projects.


Obviously, it's becoming pretty frustrating and inhibiting further  
development. So my question is…


Has anybody experienced similar problems with Flex Builder, or know  
of ways to optimise compilation times on large projects?


Any advice is greatly appreciated.


Cheers,
Lach

smime.p7s
Description: S/MIME cryptographic signature


[flexcoders] Embedding FLV into Flash 9 SWF

2007-05-17 Thread Lachlan Cotter

Hi,

There was a thread on flexcoders about a year ago talking about using  
the @Embed syntax to compile FLV video into the SWF. Apparently this  
wasn't possible back then but there was talk that it might be in a  
future version. Is there any news on this? Is there anyway to embed  
an FLV directly into the SWF file? I believe this is possible with  
Flash since MX or so:


http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14571

How do you do this in Flex?

Cheers,
Lach

smime.p7s
Description: S/MIME cryptographic signature


Re: [flexcoders] Masks, Filters, Soft Wipes

2007-05-07 Thread Lachlan Cotter
In case anyone else is interested, the solution to the bitmap cached  
mask issue is to make the mask a sibling of the target, rather than a  
child of the target, in the display hierarchy.


Then you can position it as you wish and it filters properly.

Cheers,
Lach


-

On 06/05/2007, at 12:23 AM, Manish Jethani wrote:


 Can anybody help shed some light on an odd problem with filters? I
 want to create soft edge wipe effects. I've got a pretty good proof
 of concept that works like so:

 target.cachePolicy = 'on'
 mask.filters = [new BlurFilter(20,20)]

 Sure enough, that creates a nice feather on the mask. Trouble is  
that

 the mask now refuses to be rendered in negative space. Even though I
 can trace the mask co-ordinates and verify they are in negative
 space, the mask shape renders on screen as if it was set at 0, 0.

I've tried a few combinations of this, and I give up. Seems like the
mask just won't go into negative space if it has bitmap caching turned
on (either cacheAsBitmap=true or at least one filter applied).




[flexcoders] Masks, Filters, Soft Wipes

2007-05-04 Thread Lachlan Cotter
Hi,

Can anybody help shed some light on an odd problem with filters? I  
want to create soft edge wipe effects. I've got a pretty good proof  
of concept that works like so:

target.cachePolicy = 'on'
mask.filters = [new BlurFilter(20,20)]

Sure enough, that creates a nice feather on the mask. Trouble is that  
the mask now refuses to be rendered in negative space. Even though I  
can trace the mask co-ordinates and verify they are in negative  
space, the mask shape renders on screen as if it was set at 0, 0.

Removing either of the above lines fixes the problem (but then, so  
soft wipe of course).

Anyone understand why this should be?


Cheers,
Lach




[flexcoders] Flex bug? undefined state

2007-01-01 Thread Lachlan Cotter

Hi List,

Sorry for the long winded post, but I'm completely baffled by an  
exception that my app is throwing involving an allegedly undefined  
view state. I have bound the current state of an item renderer  
component to an expression that returns one of several possible state  
names.


mx:currentState{calcCurrentState(Channel(data).syncing, open)}/ 
mx:currentState


protected function calcCurrentState (syncing:Boolean,  
open:Boolean):String {

return syncing ? 'syncing' : (open ? 'open' : 'closed');
}


Two of the states work without issues, but a third one causes   
exceptions. Flex complains that the state is undefined; a claim which  
seems to conflict with the evidence:


	a. I have stopped the app in the debugger and observed the contents  
of the states array (as it should be)


b. Although Flex claims the state is undefined, it then switches to it.

I have tried changing the name of the state, using a different state,  
removing the overrides from the state, and several other tests, all  
to no avail.


mx:states

!-- These states work fine --

mx:State name=closed
mx:SetProperty target={this} name=height 
value=55/
/mx:State

mx:State name=open /

!-- Flex claims this state is undefined --

mx:State name=syncing basedOn=closed
mx:RemoveChild target={syncBtn}/
mx:AddChild relativeTo={syncTools} position=1
mx:ProgressBar/
/mx:AddChild
/mx:State

!-- This test state produces same results --

mx:State name=myState/

/mx:states

A stack trace follows, delineated for clarity. It appears that two  
state changes are taking place. I'm not sure why that is or if it is  
normal.


Thanks for any insights you can offer.

Cheers,
Lach

ArgumentError: Undefined state 'syncing'.
at mx.core::UIComponent/::getState()
at mx.core::UIComponent/::findCommonBaseState()
at mx.core::UIComponent/::commitCurrentState()
at mx.core::UIComponent/setCurrentState()
at mx.core::UIComponent/set currentState()

at MethodInfo-5897()
at Function/http://adobe.com/AS3/2006/builtin::call()
at mx.binding::Binding/::innerExecute()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Binding/mx.binding:Binding::wrapFunctionCall()
at mx.binding::Binding/execute()
at mx.binding::Binding/watcherFired()
at mx.binding::Watcher/notifyListeners()
at mx.binding::PropertyWatcher/eventHandler()
	at flash.events::EventDispatcher/ 
flash.events:EventDispatcher::dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/::commitCurrentState()
at mx.core::UIComponent/setCurrentState()
at mx.core::UIComponent/set currentState()

at MethodInfo-5887()
at Function/http://adobe.com/AS3/2006/builtin::call()
at mx.binding::Binding/::innerExecute()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Binding/mx.binding:Binding::wrapFunctionCall()
at mx.binding::Binding/execute()
at mx.binding::Binding/watcherFired()
at mx.binding::Watcher/notifyListeners()
at mx.binding::PropertyWatcher/eventHandler()
	at flash.events::EventDispatcher/ 
flash.events:EventDispatcher::dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()
at com.couch.emotive.model::Channel/dispatchEvent()
at com.couch.emotive.model::Channel/set syncing()
at com.couch.emotive.commands::SyncChannelCommand/result()
	at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/ 
internal::applyResult()
	at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/ 
internal::callTokenResponders()
	at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/ 
internal::dispatchRpcEvent()
	at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/ 
internal::resultHandler()

at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
	at ::NetConnectionMessageResponder/NetConnectionChannel.as 
$31:NetConnectionMessageResponder::resultHandler()

at mx.messaging::MessageResponder/result()



Re: [flexcoders] Base Classes, Bindable, and dispatchEvent

2006-12-30 Thread Lachlan Cotter

Hi Steve,

I'm a little confused about how this class is supposed to work. Is it  
a subclass of ProxyObject?


You have a model object which maintains a reference to another  
(hidden) model object? If you have marked the property as bindable,  
you shouldn't have to manually dispatch events to inform listeners  
that it has changed. That's the whole point of bindings.


Probably the issue is that your listeners are not actually binding to  
the model source property of the ModelBase derived objects, so Flex  
sees no reason to update them when the source changes. What you need  
to do is throw events to inform listeners that the other properties  
have changed. But if you are explicitly coping them, I don't see why  
you should have to do that either.


Also, is it a dynamic class? I have a feeling that bindings will only  
work with statically typed classes.


Can you post the code for the ModelBase class so I can understand  
better what you're trying to do?


Cheers,
Lach


On 07/12/2006, at 4:52 AM, Steve Hindle wrote:


Hi All,

I have a base class I use for models (ModelBase, original eh?) that
contains a 'set' function. set(source:Model) - it simply copies
fields from the source model to 'this'. Works great, except I'm not
sure how to let everyone know the model changed.

The base class currently uses dispatchEvent(new
Event(ModelChanged)) to signal the change. Since I import
flash.events.*, I'm guessing this throws a flash.events.Event.

Derived classes don't throw any events.

Application code has:

[Bindable (event=ModelChanged)]
private var _model:DerivedClass;

and getter/setter for model. The setter also uses dispatchEvent(new
Event(ModelChanged)).

Problem is, the setter in the application code trips the event
listener I added...
but set() in the base class doesn't cause it to fire..

Anyone have any ideas what the problem might be?




Re: [flexcoders] disable mouse

2006-12-30 Thread Lachlan Cotter

Hi Diego,

I'm not sure if you can do that, but it's probably would be a little  
counter intuitive for uses as there is no visual indication of why  
they cannot use the app. That is what the disabled state of  
components represents, so it is the correct way to do that kind of  
thing.


Cheers,
Lach


On 08/12/2006, at 11:51 AM, Diego Guebel wrote:


Hi there,
I wonder if there is any method to disable the mouse to be clicked  
when I
change the cursor to busy avoiding disabled the components I have  
on the

screen.
I want to avoid that as I don't want to grey the application each  
time I

change cursors.

Thanks,
Diego.




Re: [flexcoders] AMF Error using Cisco WebVPN

2006-12-28 Thread Lachlan Cotter
If it is a sand boxing issue, you might be able to get around it by  
placing an crossdomain.xml file on your sever and naming the domain  
from which your external people access the app.


Cheers,
Lach


On 23/12/2006, at 5:47 AM, Rich Tretola wrote:

We have an internal application that needs to be accessed by our  
external people though webVPN client.  The application loads by my  
AMF connection to the local java class files fails with an error of:


faultCode: Client.Error.MessageSend
faultString:'Send Failed'
faultDetail:'Channel.Connect.Failed error  
NetConnection.Call.Failed: HTTP: Failed'


The application works perfectly when accessing through its direct  
URL but failed when using the webVPN where the URL is different and  
the app loads though a proxy.


Anyone else have any experience with this?

Rich




[flexcoders] Item Renderer/Item Editor confusion

2006-12-26 Thread Lachlan Cotter
Hi All,

I wonder if someone might be able to shed some light on an issue I'm  
having with item renderers. The trouble stems from the whole  
recycling thing that the list components do.

Basically, my custom renderers have two states: one for viewing and  
one for editing the data object. I double click the renderer to put  
it into edit mode.

The trouble is that if I then scroll the list component, the renderer  
is re-used to display another data object, but remains in edit mode.  
I tried using the dataChange event to put the renderer back into view  
mode, but this event seems to get fired more frequently than one  
might expect and I couldn't then edit the items at all.

Whats the best way to detect when I need to change states?

I'm also a bit confused over the whole item editor discussion in the  
docs. I don't understand why we need the concept of an item editor  
per se and the whole update cycle that goes with it, since the  
renderer component can update the data object directly on its own.

Any help appreciated.

Cheers,
Lach



[flexcoders] Indeterminate progress bar

2006-12-21 Thread Lachlan Cotter
When I set a progress bar to be indeterminate, it doesn't animate in  
polled mode or even in event mode. Is there a way to get it to  
animate other than calling setProgress directly?

Cheers,
Lach



Re: [flexcoders] Re: Newbie help: model bindings work with some but not all

2006-12-20 Thread Lachlan Cotter

Hi Tim,

What kind of control is myTags bound to?

Cheers,
Lach



On 20/12/2006, at 7:50 AM, Tim Garver wrote:


Hi All,
here is some snippets from my project that is not working.
i have included some of the code, let me know if you need all of  
it. it quite large.



The myTags data field is the one in question.

This file is opened up as a windowed page from a calling page.
the calling page passes in an object and the object is used by  
remoting to get the data on this page.


THanks in advance.
Tim




Re: [flexcoders] Checkbox MenuBar

2006-12-20 Thread Lachlan Cotter

Hi Jeremy,

Let me see if I understand you correctly: you want to have a  
horizontal menu bar where each item will drop down a list of checkbox  
controls when selected?


Cheers,
Lach


On 20/12/2006, at 10:37 AM, Jeremy Rottman wrote:

I'm having trouble thinking of a way to accomplish the next step in  
my application. Basically what we have right now is a menu bar that  
is created from a mysql query. That part I have working fine. The  
next part that I'm working on is a permission based system that say  
an admin were to login and go to the menu bar admin screen and be  
able to select which items of the menu a group has the ability to  
see. Now the easiest way I can think of laying this out for the  
admin would be to just recreate the same menu with the same queries  
but with checkboxes next to each menu item(including the top level  
item that when clicked selects all children). Basically imitating  
the TreeCheckBox component I have seen but in menu bar form.  
However I have not been able to find any examples or even any talk  
about something like this before. The reason I don't want to use  
the TreeCheckBox is because the tree would be very long and cause a  
lot of scrolling with this many sub items so really the best bet is  
to have something horizontal that I already know fits the screen.  
Does anyone have any ideas of other components or other ways that  
this task could be accomplished? Any help or opinions would be much  
appreciated.




Re: [flexcoders] Populating Multiple Levels of Branches

2006-12-20 Thread Lachlan Cotter

Hi Kyle,

Listen on your tree control for the itemOpen event. Retrieve the tree  
node from the event, pull from it what information you need for your  
next query. When the query returns, append the results as children of  
that node. Bindings should update the tree control.


Is that what you were looking for?

Cheers,
Lach


On 20/12/2006, at 9:04 AM, Kyle Hayes wrote:


I am quite new to Flex and was planning on learning it very soon
which ended up being sooner than I thought because of a project that
could really use it. So here I am.

The application I am designing needs to display a hierarchal list of
codes. All the codes are related to each other in that one is abover
another.
…



Inside my database there is a table that raggedly displays this data
in 11 columns (the 11 levels)

1   2   3   4   5   6   7   8   9   10  
11
AA  AAA
AA  AAB AABA
AA  AAB AABB
AA  AAB AABCAABCA
AA  AAB AABCAABCB

etc

So I want to query this data in which case I have already built a
function in ColdFusion to return the DISTINCT items for a level that
I specify

Which in my example would produce

AA
AB

for level 1

I am able to return that much to a tree and have it display the
folders by adding a column pragmatically to the Query called
children. There are 10s of thousands of records in this table so I
do not want to grab all this data at once. I want the next level for
a specified entity to be pulled from the CFC when I click it. How do
I append this information to a folder item?

Thanks a bunch!
-Kyle




Re: [flexcoders] SequenceCommands ... is there a point to their existence?

2006-12-20 Thread Lachlan Cotter
I came up against just this problem today and decided that the  
sequence command wasn't appropriate for reasons similar to what  
you've outlined below. The sequence is intrinsic in the actual  
command classes which obviously makes them less reusable. In my app,  
I wanted the idea of the command sequence to be at another level than  
the commands themselves.


The solution I used was to create my own kind of sequence command,  
which very simply just creates a list of other commands to be  
executed in turn. It just keeps track of where it's up to and calls  
the next command directly when the last one is done. I am not using  
the event mechanism to call the commands.


This also requires that each command post a notification that it has  
completed by firing a CommandComplete event which the sequence  
commands listens on the event dispatcher for.


Hope that's useful to you.

Cheers,
Lach


On 20/12/2006, at 8:39 AM, thegiffman wrote:


Basically these are four different commands that should be executed in
sequence. And it makes sense from an architectural standpoint for
them to be separate - I can see wanting to query for fine data in
other situations than data set creation (like an update).

But here's the kicker - sequence commands don't really seem set up to
do this. I can't really get at the commands themselves to set the
next event with the constructor, since the front controller handles
all this. As such, the sequence command can really just do one action
- querying the back end for fine grain data will ALWAYS trigger an
event to add the data set.

To avoid this, I might include a flag in the event whether to stop or
go on to the next command. But this raises the question - can't I do
this anyway with a call to the event dispatcher? The value of having
sequence commands seems to be the ability to move to the next sequence
without the sequence being hardcoded. Yet this functionality doesn't
really exist - it is hidden by the front controller.

Could someone set me straight here?




Re: [flexcoders] Adding a new button to a Tabbar without altering the dataprovider.

2006-12-20 Thread Lachlan Cotter

Hi Dan,

I can think of two possible approaches.

You could create a proxy data-provider that places a layer between  
the control and the real data provider, that manipulates the data for  
this view (by adding your pseudo item).


or…

You could create a subclass of the control that adds the  
functionality you are describing. I think this would be preferable,  
since, as you said, this is an aspect of the view, not the data.


I'll be interested to see what other ideas there are about this one too.

Cheers,
Lach



On 20/12/2006, at 8:42 PM, Dan wrote:


Hi,

I want to implement a tabBar that with the last tab labeled new so
that when ever the user click that new tab, a new tab is added to  
the

dataprovider. However, I don't want to add a new object in that
dataprovider for that labeled new tab at the tail, since it will
complicated that other operation working on that dataprovider (since
that new tab is actually not one of the data) Is there any way to
achieve it? Can i manually add a new tab to the tab bar without
changing the dataprovider?

Thx in advance for any advice.

Dan




Re: [flexcoders] Re: Load swc instead of swf

2006-12-20 Thread Lachlan Cotter

Hi Saba,

What's wrong with just loading ordinary XML files?

Cheers,
Lach


On 20/12/2006, at 10:12 PM, ssundke wrote:


Ok.. so what do I do for this problem.

I need to write some help files for my project and I need my swf to be
standalone since it can be used. I didnt want to hardcode the html in
one as file or mxml file, so I thought I would make a separate file  
for

it and let it be loaded when it was needed. Since I need my swf to be
standalone, I didnt want any dependancy on some other web resource.  
What

are my alternatives?

- Saba




Re: [flexcoders] Can I export XML from client to a new html page

2006-12-18 Thread Lachlan Cotter

Hi Vikas,

It's possible to pass data between Flash and JavaScript, so  
theoretically, it is. My memory might be faulty but I have a vague  
idea that I've done something like this in the past in a situation  
where I wanted to include some data from an embedded SWF in a form  
submission along with other fields from the HTML page. I'll see if I  
can dig it up and see if it will be useful here.


Cheers,
Lach


On 13/12/2006, at 5:49 AM, Vikas Bhatia wrote:


From flex I can open up a new html page. Is it possible to populate
that page with the xml already present on the client.

The use case is that for every grid I want to provide a csv and xml
download without going back to the server to fetch the same data. What
I would like to do is open up the new window and with
javascript/actionscript populate the new window with the xml data
formatted from within the client.

Is this possible?

Thanks.




Re: [flexcoders] why AMFPHP , i still can not get the point :(

2006-12-18 Thread Lachlan Cotter

Hi Yioit,

I believe AMFPHP was originally created to work with remoting in  
Flash (not Flex). The XML handling abilities of Flash are not in the  
same league as Flex, so XML was a huge pain. AMFPHP definitely makes  
a big difference for Flash Development.


Since Flex is so much better with XML, the benefits may not be so  
obvious depending on the specifics of your project.


I agree with you that there can be a lot of overhead in creating  
client-server interfaces and working out the best way to serialise  
data for transfer etc. As for your comment about having to write  
classes in both PHP and ActionScript: I don't see that there is any  
escaping this. Unless your application is trivially simple, then you  
will surely want to create domain model objects on the server to  
encapsulate logic and the database access. Same goes for the Flex side.


As for the most development time efficient method for architecting  
the service interface, I'm still trying to figure that out. There are  
several options for both XML and AMF in PHP and also in other  
languages. WebORB for Ruby on Rails is another alternative that can  
potentially save time once you get over the Rails learning curve and  
learn how to install everything properly (which is a significant  
investment).


You are correct that AMF serialised data is quicker to transfer and  
marshal than the equivalent XML, but this probably only becomes an  
issue when your dealing with quite large result sets.


With regard to your generalised database query over HTTP class: I'm  
all for this type of time saving solution, but I think you need to  
address a couple of issues to make it more widely useful. Namely, the  
security concern of having a service that allows clients to  
effectively design their own SQL queries to be executed on your  
server, and secondly the fact that this approach seems to bypass the  
server side domain logic.


Cheers,
Lach


On 18/12/2006, at 6:44 PM, Yiðit Boyar wrote:


hi,
i've been developing web RIA's using PHPmysql support for data for  
about 3-4 months. writing diffrent php files for every fetch type  
was sucking so i've starting developing a new class communicating  
with my own php file to fetch data. my class is so pre now but you  
may find some info about it athttp://yboyar.blogspot.com/2006/12/ 
easyreq-http-service-class-which-makes.html .
anyway; my question is sth diffrent. also i read a lot about  
AMFPHP , i still could not understand where it helps me reduce time  
to build applications since i write every class in php  actionscript.
i've downloaded AMFPHP but although i did the database setup , it  
still gives error.
So, please can someone clearly explain me how AMFPHP helps time  
reduction WHILE developing the application ? (or does it ?)
as much as i understood, it help reducing transferred data size in  
the running time. Am I right in this point ?


thanks a lot, by the way; what do you think about the tool i  
develop; does it seem helpful or useless ?




Re: [flexcoders] Can I export XML from client to a new html page

2006-12-18 Thread Lachlan Cotter
It appears that in my old Flash based app, I used LocalConnection and  
a gateway SWF to call JavaScript functions. This info might put you  
on the right track for doing something similar in Flex:


http://www.adobe.com/devnet/flex/articles/analytic_app_05.html

Cheers,
Lach


On 18/12/2006, at 9:55 PM, Lachlan Cotter wrote:


Hi Vikas,

It's possible to pass data between Flash and JavaScript, so  
theoretically, it is. My memory might be faulty but I have a vague  
idea that I've done something like this in the past in a situation  
where I wanted to include some data from an embedded SWF in a form  
submission along with other fields from the HTML page. I'll see if  
I can dig it up and see if it will be useful here.


Cheers,
Lach




Re: [flexcoders] Creates Duplicacy in Datagrid

2006-12-18 Thread Lachlan Cotter

Hi Gaurav,

That's the standard and intended behaviour in pretty much all  
applications. If you really want to change it, you need to define  
your own custom drag handler methods on the DataGrid.


Cheers,
Lach


On 18/12/2006, at 10:44 PM, Gaurav Jain wrote:


Hi All,



I have a Datagrid in my application and I can change the position  
of the rows by dragging a particular row and dropping it at  
required position. But whenever I press Ctrl key and drag and drop  
the row (i.e. Ctr l+ Drag-Drop) it creates a duplicate row at that  
position.




Can any one help me out on this.



Thanks in advance.



Gaurav




Re: [flexcoders] Re: How do I reset itemRenderer inside DataGrid when dataProvider is updated?

2006-12-18 Thread Lachlan Cotter
Sorry if this is out of left field (and wrong), as I haven't read  
through the rest of the thread, but is it the case that dataChange is  
fired during scrolling because the item renderers are reused by the  
list control with different items in the dataProvider?


Cheers,
Lach


On 19/12/2006, at 11:08 AM, Tom Lee wrote:

as is so often the case, we have no answer to the question at hand  
(why does a dataChange event fire when the datagrid is scrolled?)




Re: [flexcoders] Equality and strict equality

2006-12-17 Thread Lachlan Cotter

Thanks Greg,

Okay so the distinction is to do with types rather than with identity.

In that case, how does one compare two objects by value?

For example if, I have two separate instances of a class which happen  
to have the same value, as in


var foo:MyObject = new MyObject;
var bar:MyObject = new MyObject;

How do I test their equality by value (not by reference)?

Is there an operator for this, or do you have to write your own  
comparison methods?


If the former, does ActionScript distinguish between shallow and deep  
comparisons?


Cheers,
Lach



On 17/12/2006, at 5:04 PM, greg h wrote:

http://livedocs.macromedia.com/flex/2/langref/ 
operators.html#strict_equality


After reviewing the link above, please post back with any further  
questions.




Re: [flexcoders] Equality and strict equality

2006-12-17 Thread Lachlan Cotter

Thanks Ralf,

Is there a standard interface that one should implement to do this?  
For instance,


class MyObject implements IComparable
{
public function compareWith (b:Object):Number;
}

something of that nature? Nothing obvious came up in the documentation.

Cheers,
Lach


On 17/12/2006, at 9:15 PM, Ralf Bokelberg wrote:


I'm afraid, you have to write your own comparison methods.
Cheers,
Ralf.




Re: [flexcoders] Making objects vs extending objects and their properties

2006-12-17 Thread Lachlan Cotter

Hi David,

As I was recently reminded, you can only loop over properties this  
was when they are dynamically created, as in your first example. To  
enumerate the declared properties of your custom class, I believe you  
need to use the describeType() or getClassInfo() methods. See  
'performing object introspection' in the docs for details on this.


Cheers,
Lach

On 18/12/2006, at 9:20 AM, David Harris wrote:


Hi Guys,

Anyone know how I loop over properties of a Class that extends  
Obejct


Here is an example of what I mean...

if I go:

var oThisObject:Object = {one:one,two:two,three:Three};

I can do this:
for(var s:String in oThisObject){
trace(s);
}

and will trace out one,two,three

If I create a class
package somePackage
{

[Bindable]
public class MyCustomClass extends Object
{
public var one:String = one;
public var two:String = two;
public var three:String = three;
}
}

and then have
var oThisObject:MyCustomClass = new MyCustomClass();

I can't do this:
for(var s:String in oThisObject){
trace(s);
}

and get any results...
...also the toString breaks...

I want to be able to do the second option as the properties on the
Class will be changed and added to, i would lke to refer to them
dynamically...

Cheers,

David




Re: [flexcoders] Image Loading dynamically

2006-12-16 Thread Lachlan Cotter

Hi Kumar,

When you say 'loaded already', do you mean that you want the images  
to be pre-compiled into the SWF? There may be a better way to do it,  
but this is one method that seems to work.


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;  
layout=absolute


mx:Script
![CDATA[
import mx.collections.ArrayCollection;

[Embed(source='image1.jpg')]
private var image1:Class;

[Embed(source='image2.jpg')]
private var image2:Class;

[Bindable]
private var myImages:ArrayCollection =
new ArrayCollection([image1, image2]);  
]]
/mx:Script

mx:Image source={myImages.getItemAt(0)}/

/mx:Application

Cheers,
Lach

On 16/12/2006, at 7:37 PM, KP wrote:


Hi All,



Is there a way to load complete set of images in any array or any  
thing like that so that later it can be used for any other purpose  
example slide show.Currently I am storing source of the image in an  
xml file and from there I am changing or rather assigning source of  
image control to create an slide show but what I want is to create  
a slide show in which all the images are loaded already in any  
variable or collection and then I can manipulate that collection to  
switch the source of image.




Kumar




Re: [flexcoders] want to load multiple XML files to populate various controls

2006-12-16 Thread Lachlan Cotter
Are you calling send() on each of the services? Are errors reported,  
or does it just silently fail?



On 16/12/2006, at 9:33 AM, danj520 wrote:


can you have multiple instances of httpService?

Here is my code:

mx:HTTPService id=adapSrv url=data/adapters.xml/
mx:HTTPService id=attenSrv url=data/attenuators.xml/
mx:HTTPService id=btSrv url=data/biastees.xml/
mx:HTTPService id=combSrv url=data/combiners.xml/
mx:HTTPService id=termSrv url=data/terminations.xml/
mx:HTTPService id=popSrv url=data/popular.xml/

When run, app finds the popSrv path and loads the data, but won't
find any other paths even though the files exist in their respective
paths. Any help would be appreciated.




Re: [flexcoders] Image Loading dynamically

2006-12-16 Thread Lachlan Cotter
Probably you need to use a bunch of loader objects to pre-load the  
images. You might approach it something like this:


1. start with your collection of filenames
2. enumerate over them, creating a loader object for each
3. add an event listener to each loader so you know when it is done
4. when you get notification that an image is loaded, increment some  
tally
5. when the tally equals the length of your original collection, you  
are good to go


Someone else may be able to elucidate the finer points of using  
loaders and how to then use the loaded content in other controls.


Cheers,
Lach


On 16/12/2006, at 11:30 PM, KP wrote:


Thanks Lach for your reply.



If you remember once you have replied for slideshow component  
creating it quickly.


Well in that you were putting the urls of images in the array  
collection.and then you were changing the source of images with the  
help of timer control.


I want to dynamically load all the images directly in the array  
collection and then directly use get item method to show in the  
slide show.


Can this be done.



Kumar




Re: [flexcoders] Repeater Control

2006-12-16 Thread Lachlan Cotter

Hi Kumar,

I fear one of us does not grasp the concept of the repeater class.  
The way I understand it, it's for repeating the instantiating of a  
child object, not for repeating the firing of events per se. I think  
the solution to your question here is not unlike the slideshow example.


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;  
layout=absolute

creationComplete=init()

mx:Script
![CDATA[

[Bindable]
public var firstLabel:String;

[Bindable]
public var secondLabel:String;

private var timer:Timer;

[Bindable]
private var count:Number = 0;

private function init ():void
{
timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, 
doChange);
timer.start();
doChange(null);
}

private function doChange (e:TimerEvent):void
{
var length:Number = 
XML(myData).children().length();
firstLabel = XML(myData).child('student')[count 
% length].name;
secondLabel = 
XML(myData).child('student')[(count+1) % length].name;
count += 2;
}
]]
/mx:Script

mx:XML id=myData
root
student
nameABC/name
/student

student
namePQR/name
/student

student
name123/name
/student

student
nameXYZ/name
/student

student
nameRST/name
/student
/root
/mx:XML

mx:VBox
mx:Label text=VALUE: {firstLabel}/
mx:Label text=VALUE: {secondLabel}/
mx:Label text=COUNT: {count}/
/mx:VBox


/mx:Application

So I don't really see how the repeater comes into it. Did I  
understand your question properly?


Cheers,
Lach


On 16/12/2006, at 10:57 PM, KP wrote:

Now I want to display contents of this xmllist in a label control  
with a repeater control which repeats after few sec and displays 2  
items at a time which means in first 5 sec I want to display ABC  
and PQR for the next 5 sec 123 and XYZ and soon.and this should  
repeat I know it will need a repeater control for this but I am not  
able to figure out best possible way of displaying contents.can  
some one help me out of this.




Thanks

Kumar




Re: [flexcoders] Re: Merge two XML documents

2006-12-16 Thread Lachlan Cotter

Hi Collin,

Is your data always a flat list of string values? or does it have  
'depth'? Because if so, you might need to change how you examine your  
data.


Cheers,
Lach


On 17/12/2006, at 6:13 AM, Collin Peters wrote:


By merge I mean that this XML
root
  node id=1value1/node
  node id=2value2/node
/root

and this XML:
root
  node id=2value2/node
  node id=3value3/node
/root

would become this XML:
root
  node id=1value1/node
  node id=2value2/node
  node id=3value3/node
/root

I am current doing this which seems to work well.  I don't think  
there will be anything more efficient


for each ( var x:XML in _xml.key ) {
 if(!_mainXML.contains(x))
  _mainXML.appendChild(x);
}




[flexcoders] Equality and strict equality

2006-12-16 Thread Lachlan Cotter
Can anybody point me to a comprehensive reference that explains how  
equality and strict equality works in ActionScript 3. Presumably  
strict equality means two variables hold the exact same instance. How  
is non-strict equality determined with non-primitive objects,  
collections and the like?

Cheers,
Lach


Re: [flexcoders] Error In Service Browser

2006-12-15 Thread Lachlan Cotter
The error means that the object you are assuming to be of type  
ErrorMessage was in fact just a plain object. You cannot cast an  
Object to an ErroMessage because it is missing all the methods and  
properties that an ErrorMessage is supposed to have.


Cheers,
Lach


On 15/12/2006, at 3:22 AM, runnerr wrote:


Hi All,

Im getting an error in the service browser:

TypeError: Error #1034: Type Coercion failed: cannot convert
[EMAIL PROTECTED] to mx.messaging.messages.ErrorMessage.

I have tried to look deeper into the code but I cannot figure it out.




[flexcoders] Flex Store Example + collection view optimisation

2006-12-14 Thread Lachlan Cotter
The collection view classes in Flex such as List, TileList, DataGrid  
etc. have an optimisation so that the component only instantiates  
enough item renderers to display the items currently on screen. This  
is presumably a necessary optimisation to keep from consuming massive  
resources when rendering large collections.


The Flex 2 Store example implements a custom collection view that  
does animation of renderers and state changes etc. and does live  
filtering of the collection as the user drags a slider. It's  
considerably cooler than the standard classes.


I want to do something similar in my app.

The question

As far as I can tell, the Flex Store isn't optimised for renderer  
minimisation the way the standard collection classes are. I would  
like to know at what point this approach is likely to run into  
performance issues with collections approaching say two – three  
hundred items.


Does anyone have any experience with this kind of thing?

Cheers,
Lach

[flexcoders] Adding functionality to existing classes

2006-12-14 Thread Lachlan Cotter
Is there any way in ActionScript 3 that you can add methods to an  
existing class short of declaring a new subclass? Something akin to  
Ruby's open classes or Objective-C categories, or the _prototype  
property in ActionScript 2. Anything like that?

In particular, I want to add some methods to Array and  
ArrayCollection to do enumerations, searches and the like.

Cheers,
Lach


Re: [flexcoders] Re: Adding functionality to existing classes

2006-12-14 Thread Lachlan Cotter

Hi Ben,

That's what I'm doing currently, but it's not ideal because I have to  
instantiate my class each time I want to use the methods which  
detracts somewhat from the convenience factor. Perhaps something  
cleaver can be done with proxies?


Cheers,
Lach


On 14/12/2006, at 11:46 PM, ben.clinkinbeard wrote:


You could write a completely separate utility class that uses Arrays
and ArrayCollections thru composition.

HTH,
Ben

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

 Is there any way in ActionScript 3 that you can add methods to an
 existing class short of declaring a new subclass? Something akin to
 Ruby's open classes or Objective-C categories, or the _prototype
 property in ActionScript 2. Anything like that?

 In particular, I want to add some methods to Array and
 ArrayCollection to do enumerations, searches and the like.

 Cheers,
 Lach




Re: [flexcoders] Scrolling without a scrollbar

2006-12-14 Thread Lachlan Cotter
If you don't have a track and a thumb, I wouldn't really call it  
scrolling. Perhaps what you're really after might more accurately be  
called 'paging'. If you think of it in those terms, does the problem  
become easier to grasp?


Cheers,
Lach

On 06/12/2006, at 8:18 AM, graysonpierce wrote:


We have a requirement for a scrollable container that displays right
and left arrows (when necessary) but not the track and the thumb.

To be more exact something similar to when you open up a bunch of tabs
in Firefox and at the point that it can't make the tabs any smaller it
displays the right and left icons.

Anyone have anything that might be a head-start? Don't really want to
get into measuring individual components (mostly buttons), etc. to
write it myself.

TIA.




Re: [flexcoders] Dispatched Events from within a Subclass

2006-12-14 Thread Lachlan Cotter

Hi David,

One way to do what you want is as follows:

1. Your form subclass should add an event listener to its delete  
button in some initialise method that is called on creationComplete.


2. The handler for that button press event should dispatch ANOTHER  
event. This event is of a custom type that you define and describes  
the meaning of what occurred. For instance  
DeleteScheduleRequestEvent. This event should encapsulate enough data  
for your controller (which may be the parent document), to know the  
appropriate response for the event. This data will no doubt include  
the schedule object which is to be deleted.


3. Your parent document should add an event listener to the form  
instance to catch these deletion request events. It can then respond  
appropriately. The controller doesn't need to know which button was  
involved, only the meaning of what the user is trying to do by  
pressing the button. This is the reason for your custom event type.


If your forms are also nested inside a repeater it should also work  
to add the event listener to the repeater to catch events that occur  
on its children.


Cheers,
Lach


On 06/12/2006, at 2:56 PM, pedalspeed1 wrote:


Two Parts:

I have a sub-classed form that has multiple components. The
sub-classed form is a scheduling widget and the user can
create/update/delete multiple schedules.

The form has a delete button. When the user clicks the delete button,
I need the parent document to listen for this specific button's press,
and then to remove the particular subclass.

My confusion is: How do I get a parent document, to listen to a
specific instance, within a subclass, within a repeater?

Best.
D.Buhler




Re: [flexcoders] datagrid itemrenderer

2006-12-14 Thread Lachlan Cotter

Hi,

I'm not sure I fully understood your issue. Is it something to do  
with transparency or background colour on your item renderers?


Why don't you post some example code so we can get a better idea of  
what is not working.


Cheers,
Lach


On 06/12/2006, at 5:24 PM, rthi99 wrote:


Hi all,
I am using itemrenderer on headerclick of a datagrid trying to chane
colours based on values.
There seems to be a problem in the cells that i am not colouring.They
are colorless and it is not the same color as the datagrid as such..
The datragrid has alternating colors for rows.How can i preserve the
properties of the datagrid column
Hope i am clear
thanks




Re: [flexcoders] How to create a nested non-visual component

2006-12-13 Thread Lachlan Cotter

Hi Harry,

This is so you can instantiate and populate your class in MXML?

I don't think you have to do anything special. Just define public  
properties or accessor methods on your class. You can then  
instantiate your class in MXML, setting the value of properties with  
child elements. For instance, if your class looks like this:


public class MyClass
{
public var name:String;
public var children:Array;
}

You can then say:

MyClass
nameA string/name
children
mx:StringSome other objects here/mx:String?
mx:StringOr whatever else you want to put here/mx:String?
/children
/MyClass

Does that answer your question?

Cheers,
Lach

On 09/12/2006, at 10:33 AM, Du, Xiaochen ((Harry)) wrote:


Hello all,

I want to create a non-visual component that can have another non- 
visual component as child.

For example:
MyComponentA
MyComponentB/
/MyComponentA

How to do that?

I know I should implement the AS class of MyComponentA from  
IMXMLObject like the following. But I don't know how to make it  
enable to accept another non-visual component as child.


public class MyComponentA implements IMXMLObject
{
public function initialized(document:Object, id:String):void
{
trace(id);
trace(document);
}
}

You help is highly appreciated.

Regards,
Harry




Re: [flexcoders] Business Objects and Value Objects/Cairngorm. Distinction?

2006-12-13 Thread Lachlan Cotter

Hi,

Although Alex may already have answered your question, I thought a  
more general explanation might also be helpful.


A business object represents an entity in the domain (the real world  
system of which the application is a software representation).  
Business objects should encapsulate logic such as relationships and  
validations which describe the business rules. They should be  
reusable across various applications as they know nothing about user  
gestures or application structure.


Value Objects, are just bundles of properties and information that  
may or may not correlate with actual business entities. They are more  
concerned with moving information around in convenient chunks and  
providing 'views' of the data than actually representing business  
logic. As such, they are more specific to the particular needs and  
processes of a given application. In other frameworks they are  
(perhaps more aptly) called data transfer objects.


Personally I would say that it is not at all fair to say that  
business objects are just collections of value objects; but I don't  
blame you for getting that impression, because that's how they tend  
to be talked about in Cairngorm.


Cheers,
Lach



On 10/12/2006, at 5:53 AM, lostinrecursion wrote:


I have one question for someone who may know. Could someone tell me
the difference between a Business Object (such as the one Alex uses to
encapsulate model properties) and a Value Object (which I am used to
constructing).

Is it fair to say a business object is just a faux collection of
various Value Object (and non VO) properties in one convenient  
location?




Re: [flexcoders] change state and issue command

2006-12-13 Thread Lachlan Cotter
You shouldn't need a function to populate your view. Use bindings to  
tie it to the data model. It might also be worth looking over the  
docs for the DataGrid and TabNavigator to see what events they fire  
and when.


Cheers,
Lach


On 10/12/2006, at 5:14 AM, bghoward3 wrote:


here is my situation

i have an app with 2 states, the first state is a dashboard with a
grid on it when user clicks item in grifd it goes to state 2 where a
tabnavigator exists and the compoents display the selected items
information

this works fine the first time through since my function to populate
is called on the creationcomplete of the embedded component

i am having a problem in getting it to redraw or send it the
function to redraw since since the component lies in a differnt
sdtate.

so is there a way to call a function everytime in an embeded
component whenever the new state loads so that the info populates
correctly?

or do i need to create some sort of listener

thanks




Re: [flexcoders] To Remote Call or Not To Remote Call in Cairngorm

2006-12-13 Thread Lachlan Cotter
Your plan sounds like a good one to me. For extra efficiency, you  
might also want to keep track of what calls you have pending. For  
instance, you may have issued a call to get the data but it has not  
yet arrived. Just depends on how nice you want to be to your server.


Cheers,
Lach


On 07/12/2006, at 4:06 AM, Brian Holmes wrote:

For fairly static data that is bound to many different views, I  
only want to go to the server when the data's not there.


…

 My first inclination on handling this is to look at the  
ModelLocator to see if the data is null or not and act accordingly  
and that works great.


So I was wondering where and how other people are managing this  
kind of logic.



Thanks,
Brian.




Re: [flexcoders] Use an Image as an icon

2006-12-13 Thread Lachlan Cotter

Hi Even,

I may be wrong, but I'm pretty sure the case is this:

Meta-data and embedded assets are interpreted at compile time.

Program variables are assigned at runtime.

It doesn't really make sense therefore to assign a compile time  
constant the value of a runtime variable. I.e. var image won't ==  
'image.jpg' until your program is running. I'm not sure I really see  
the point of what you're trying to accomplish here.


If you want to change the button's icon while the program is running,  
you might have to say something like:


[Embed('about.jpg')]
public var img:Class;

public function changeIcon ():void
{
btn.setStyle('icon', img);
}

Cheers,
Lach



On 07/12/2006, at 8:31 AM, ejb4424 wrote:


Hello. Can anybody tell me either how to use an image as an icon, or
convert an image to a class for use as an icon (in components, the
icon is of type Class)? Or better yet is it possible for
me to dynamically embed an image via a variable?

Sure the usual embed assertion works:
[Embed('image.jpg')]
[Bindable] var img:Class;
...
mx:Button label=button icon={img} /

But what I want to do is embed the image via a variable such as:
var image:String = image.jpg;
[Embed(image)]
var img:Class;

What I'm trying to do is a bit more complex, but help with this simple
example should get me going. Any help would be appreciated. Thanks.

Evan




Re: [flexcoders] Shuffle items in Repeater

2006-12-12 Thread Lachlan Cotter

Hi Joe,

I think there might be a way to do it, but it's not pretty. Probably  
better off using a list or something similar instead of a repeater,  
because the repeater isn't much help after it has actually  
instantiated it's contents. The list is a little more work because  
you have to go and define a separate item renderer class and set up  
some event handling to manipulate the data provider, but I believe  
this would be the correct way to do what it is that you are asking.


Cheers,
Lach


On 12/12/2006, at 1:10 PM, Joe wrote:


I have a repeater that verticaly displays about 12 buttons. Is it
possible to change the index of the button that is selected. If I
selected a button in the middle of the repeater can it would move to
the top. Or if it can't move, maybe change the label of the button on
the top to read what I just selected.

Should this not be in a repeater? Help !!!




Re: [flexcoders] Shuffle items in Repeater

2006-12-12 Thread Lachlan Cotter
Ah, excellent. I was trying repeater.currentIndex, but this throws an  
exception when used any time other than instantiating time.


On 13/12/2006, at 3:56 AM, Ralf Bokelberg wrote:


bringToTop( event.target.data )




Re: [flexcoders] extending classes question (AS) (.HTTPService)

2006-12-11 Thread Lachlan Cotter

Hi Yigit,

Some of the Flex framework classes are written in ActionScript and  
can be viewed in the SDK, others are part of the actual Flash player  
platform and are not accessible this way. I suspect the HTTPService  
class belongs in the latter classification.


You can still override methods of the class however. Define your send  
method like this:


override public function send(parameters:Object=null):AsyncToken
{
// Your custom code here.
// …
return super.send(parameters);
}

The last line invokes the default implementation passing the  
parameters and returning the result as the result of your custom  
override.


I'll be interested to learn of developments to your custom service  
class.


Cheers,
Lach

On 11/12/2006, at 8:07 AM, Yiðit Boyar wrote:


i'm developing a new class based on mx.rpc.http.mxml.HTTPService .
it will have some cool features which will be integrated with  
phpmysql.. anyway, when i do sth worth using, i will send it  
here.. but now i have a problem;
i need to add some additional code to the default send function but  
i can not find it's source code ? (not included in flex sdk ?? )  
how can i find it or is there a way to do what i want ::
when send function is called, one of my functions will run first  
(it will do some edit on the request data) then call the default  
send function..
i see, by creating a new function it is so easy (e.g. send2) but i  
want my function to be called when the default send is called. (so  
make it easy to use), in other words; i dont want to force the user  
call another function to send the request except send...

thanks for your helps...




Re: [flexcoders] HDividedBox

2006-12-11 Thread Lachlan Cotter
Perhaps there is another way to clip or mask the content without  
relying on layering it with other components.


Cheers,
Lach


On 10/12/2006, at 5:42 PM, jroblang wrote:

Is there any way to permanently change the child order in an  
HDividedBox so that the child
on the right side of the DividedBox is behind the child in the  
left side. I've used the
swapChildAt method which works fine until you move the Divider.  
Upon release of the
divider, the child order changes and the left side flips over to  
the right side.


The content in the right side of the Divided Box can sometimes  
overflow and I need it to be

behind the left side content.

Thanks for any suggestions.




Re: [flexcoders] Re: Cairngorm's Anaemic Domain Model

2006-12-11 Thread Lachlan Cotter

Hi Peter,

Thanks for this information, it has certainly helped to clarify some  
things in my mind.
With Cairngorm Enterprise one of goals is to promote an application  
model on the client (RIA) and a domain model on server. We see the  
application model being a good OO model that reflects the UI and  
tells us about the entities and their relationships that we are  
surfacing. It will also encapsulate all the business rules that  
apply to the UI. I see this being different to the domain model and  
the business rules that reside on the server.
The thing that is most interesting to me here is the talk of  
relationships because this is what seems to be lacking somewhat in  
the current Cairngorm paradigm. Not to imply that it can't be done,  
just that it doesn't seem to be part of the standard practice.
This sort of shifts the concept we have at the moment, whereby you  
call a command, which may invoke a service via a delegate. In  
essence we are going to move the delegates behind the model and  
have the command call an operation on the model.

This sounds promising. Where does this put the service locator?
In essence it would be nice to see VOs / DTOs being used for  
transporting data rather than making their way in to the view via  
the ModelLocator.
Again, glad to hear this is an issue for others as well. In simple  
cases, the VO is adequate because it sufficiently represents both the  
domain object and the view you want to take of it. When the  
relationships become more complex however, inconsistencies begin to  
arise. For example, when you have many-to-many relationships and such  
and you want to be able to traverse the object graph in bindings or  
whatever, you need to construct a more interconnected object graph  
rather than a collection of records as it were. Then you have the  
problem of how you get from A to B. Is there a best practice you are  
advocating for mapping and building object graphs out of data in  
DTOs? or is it left up to the specific requirements of the application?




Re: [flexcoders] upload file progressbar

2006-12-11 Thread Lachlan Cotter
What's happening on the server side? Are you sending files to a real  
service? or just a dummy URL? Do you get the same results with other  
files?


Cheers,
Lach


On 11/12/2006, at 9:54 AM, Philippe wrote:


Hi,

I use a progressbar to watch a FileReference upload. Everything is  
ok but

when I upload a 2000k file for example at 20K/sec upload speed, the
progressbar completes in 2 sec and then the upload continues in the
background.

Thanks for help
Philippe




Re: [flexcoders] Calendar component

2006-12-11 Thread Lachlan Cotter

Hi,

Flex can't access your database directly; you will need some  
intervening service code on the server written in something like PHP,  
Java, Ruby, ASP etc.


Your service code needs to query the database and output an XML  
document representing the result. For example:


calendar
event
nameChristmas/name
date2006-12-25/date
/event
event
nameNew Year's Day/name
date2007-01-01/date
/event
/calendar

Flex can read in the XML with the HTTPService object. You can use the  
result event on the HTTPService to do what you want with the data,  
like binding it to your view.


I'm not sure what you have in mind as far as visualising the  
information.


Hope that is of help.

Cheers,
Lach


On 10/12/2006, at 10:27 PM, ahmedemara1984 wrote:


Hi everybody
I'm very new in flex and asking you to help me

I have some events recorded in database I want to display this events
in date chooser or if a calendar component is available via
HTTPService

I want the simplest way to accomplish this task

Please help




Re: [flexcoders] problem with a for each loop

2006-12-11 Thread Lachlan Cotter
What happens without the casting? Casting means 'treat this variable  
as'. The properties of A and B are not on a plain Object. That might  
be why you can't enumerate them.


Cheers,
Lach


On 12/12/2006, at 7:44 AM, leo4beer wrote:


Hi, I got a problem with a for each loop.

I have a class (B), B has a long inheritance chain where the oldest
ancestor is class A.
Class A does not declare an extension of any other class therefore I
take it that it extends the Object class:

All classes that don't declare an explicit base class extend the
built-in Object class.
http://livedocs.macromedia.com/flex/2/langref/Object.html

Somewhere in my code I'm trying to use a for each loop in order to
explore the members of B.

[code]
var obj = Object(instanceOfB);

for each(var prop:Object in obj){
//do some thing (my code never gets here)
}   
[/code]

The problem is that although B (and instanceOfB ) has a number of
members the for each loop ignores them all and never goes in side
the loop.
(I used the casting in order to demonstrate that I'm actually using an
inheritor of the class Object)

What am I doing wrong here?




Re: [flexcoders] Focus Rectangle Issue with Effects

2006-12-11 Thread Lachlan Cotter
I've also had similar issues with the focus rectangle. One that  
springs to mind is that a focus rectangle on a scroll thumb will  
sometimes stay put even when the thumb is dragged somewhere else in  
the scroll bar.


Also this morning, a colleague is having an issue with a focus rect  
that hangs around even when the text field it is focusing is removed  
from view (during a state change).



On 11/12/2006, at 2:53 PM, jmcwilliams2003 wrote:


If I have two movieclips on the stage A and B.

I select MC A and change the rotation value using a scroller.

If I then select MC B, the focus rectangle around MC B has the same
rotation value as MC A, except the MC itself is not rotated at all.

This is very odd behavior and looks weird on the screen. Everything
actually works, but the MC B focus rectangle is rotated and in the
wrong place.

Its as if I select an object with rotation, the focus rectangle is
correct. But, if I then immediately select any object without
rotation, the blue box rectangle still has the rotation (not the mc
itself). Its almost as if the focus rotation is not being reset  
properly?


This even happens when I select a combo or text box. Pretty much
anything that can have focus.

Has anyone else seen this behavior? Is there a way to work around it?

Thanks,
Jason




Re: [flexcoders] Design Pattern/Best Practices for generic record 'list' and 'detail' view Component

2006-12-08 Thread Lachlan Cotter

Hi Steve,

Is your problem to do with your rules about which view to display? If  
it's getting a bit complicated or 'crufty', then you probably need  
another level of abstraction. Encapsulate your rules about which view  
should be displayed inside a getter called currentView. Bind your  
view stack to this.


Now you need to work out how that variable gets updated when  
appropriate. One way is to make this a bindable property with a  
custom event type. Now dispatch that event type when the length of  
dataProvider changes. Obviously, your getter method for currentView  
has to contain the logic you described for deciding which view to use.


Is that what you were looking for?

Cheers,
Lach




On 06/12/2006, at 5:27 AM, Steve Hindle wrote:


Hi All,

I'm trying to create a component to use as an example or 'template'
of how to achieve a record list and detail view in flex. I'm starting
with a simple 'contact' record (model) that has name, address, phone,
email, etc. The list of records is held in _dataProvider, and the
specific record to be displayed in the detail view is held in _model.
My goal is to have a nice clean skeleton of how to handle this sort of
display.

My component is a viewstack with 2 views:
View 0: a datagrid displaying summary info of a list of records
(title, first, last). Double click on an entry should
open it in the
'detail' view. dataProvider is bound to _dataProvider, an
arrayCollection.
View 1: a custom component that displays all my model fields.
It has a 'model' property that is used to set the
record to be displayed.
model is a single static instance of my record type, and
all fields in the
view are bound to it ( eg text='{_model.last_name}' )

The logic for the component is pretty simple:
1. Initial view is determined by _dataProvider.length
2. if _dataProvider.length = 1, default to 'detail' view of that  
record

3. if _dataProvider.length  2, default to 'list' view
4. if _dataProvider.length = 0, add a new empty record and
default to 'detail'
view to allow data entry.

This mostly works - however, I run into 'odd' problems with
dataBinding and Initialization, etc. As my script gets cruftier with
all sorts of special case logic, and
manually poking stuff to get dataBindings updated, I wonder if perhaps
others have a better Design Pattern or template for this ??

I'd appreciate any feedback...




Re: [flexcoders] socket question

2006-12-06 Thread Lachlan Cotter

Hi David,

I tried doing something similar to this a while back but without  
success. Others have also noted that there is no way to do thread- 
blocking in Flex. The problem is that your onData method won't even  
get called until next time through the Flex event loop; and that's  
not going to happen until after getServerData has returned. So  
unfortunately(?) it doesn't work to hang around in a loop until the  
service call returns. I think you might be disappointed with this one.


Cheers,
Lach


On 07/12/2006, at 11:00 AM, David Buitenveld wrote:


Hi all -

I am creating a server interface, one of whose implementations
involves talking over a socket connection. I have a need for
synchronous behavior - I call an API method, say
getServerData(aParam), and I get back the result that I want. Not sure
what a good way to do this with sockets would be since the receive
data event makes them asynchronous in nature - can anyone point me
to a good tutorial, or provide a hint?

Consider a made up example :

class SocketServer implements Server
private var _lastResult:String;

// client calls this method and expects a result passed back
public function getServerData(aParam:String): String {
_socket.addEventListener(ProgressEvent.SOCKET_DATA, onData);
connectToSocket(someHost, somePort);

_lastResult null;
issueCommandViaSocket(aParam);

// sit around until we get data
while (_lastResult == null) ;
return _lastResult;
}

private function onData(e:ProgressEvent):void {
_lastResult= socket.readUTFBytes(socket.bytesAvailable);
}

this works conceptually, except that the wait around part hangs the
app.. if I remove that, then I can get the return value and log it in
the onData method.. so, am I even on the right track here? Is there
some way to have actionscript pause or wait until the desired event
gets fired?

thanks for any thoughts -

david




Re: [flexcoders] ListBase.as getting called after Drop to Datagrid--Preventing the Drop???

2006-12-05 Thread Lachlan Cotter

Hi Wayne,

By any chance did you forget to register your event handler with the  
DataGrid? Just a thought.


Cheers,
Lach


On 30/11/2006, at 1:07 AM, wayneposner wrote:


I'm trying to drag-and-drop from a tree to a datagrid. I've followed
the examples to try to achieve this, but whenever I drag over the
datagrid, it refuses to accept the drop. The datagrid acts like the
dropEnabled flag is set to false. I've traced the code and despite
the fact that I have a custom dragEnter handler, it still executes the
handler found in ListBase.as which cancels out my handler.

Does anyone know what would cause this? Thanks!

My Handler is as follows:

private function onDragEnter( event:DragEvent ) : void
{
DragManager.acceptDragDrop(UIComponent(event.currentTarget));
}




Re: [flexcoders] drag n drop manager

2006-12-05 Thread Lachlan Cotter

Hi Rajesh,

When you say that the object is moved or disappears when you drop it  
on the application, is that because you haven't set up event handlers  
to receive the dropped data?


There are at least two methods you could use to remove the drag  
operation.


1.  Do a test in the method that initiates the drag to see if the  
target is 'eligible' to be dragged.


2. Remove the event handler from the object when it is dropped on the  
canvas.


Cheers,
Lach


On 05/12/2006, at 12:34 AM, raju_bb wrote:


Hi people,
I am using flex 2..i m creating an application using Drag n Drop
Manager.I have a main Application which has a small library kind of
module similar to Flash Library.This library will contain all the
images in it..Now what i want is to drag images from that library and
place it on the stage or my canvas of my application.This part is
working well but once i drop it on the main application(canvas) the
object from the library gets moved/disappear.After i have dropped the
target application is there any way to remove the drag operation on
that dropped object.
How to go for this..Can anyone help me out with this..

Regards,
Rajesh Bhadra




Re: [flexcoders] Re: Cairngorm’s Anaemic Domain Model

2006-12-05 Thread Lachlan Cotter
My question isn't about the model locator. It's about logic, or lack  
thereof encapsulated within the domain objects.



On 05/12/2006, at 9:59 PM, Tim Hoff wrote:


It doesn't matter if it's a collection of dumb value objects, a
component, a state variable, or just a common effect. If an object
is used more than a couple of times in the app, put it in the
ModelLocator.  Remember, everything is an object; instantiated and
destroyed like the rest of them (GC?:)).  The key is; does the object
need to be reusable?  If so, make it central.

-TH

p.s. right on Tom.




Re: [flexcoders] Returning values from objects on another canvas

2006-12-05 Thread Lachlan Cotter

Hi,

There are a couple of different issues here.

First, why do you need to get a reference to the other view? If it is  
in order to access or manipulate the data therein, the better  
approach is to bind both views into some dataProvider and manipulate  
the data through that.


Second, the reason you can't address the sub-components at compile  
time is that they are not part of the canvas class (they are children  
of your instance). Notwithstanding the above paragraph, if you still  
need to access them this way, you might want to define your own  
subclass component with these child properties, so Flex Builder can  
find them at compile time.


Finally, just a guess but perhaps dgselectedOptions is null at  
runtime because at the time your function is executing, that  
component has not yet been initialised. Check the creationPolicy of  
the tab navigator.


Cheers,
Lach

On 05/12/2006, at 5:19 PM, michrx7 wrote:


How does one go about referencing objects on another canvas? For
example I have a tab navigator with 4 tabs:
Register
Attendees
Membership
Payment Options

Inside the attendees tab I have a canvas: csAttendee with a datagrid:
dgselectedOptions

When the user submits the pay button on the payment options tab I
call a function to validate their input and try and reference the
columns array for the datagrid dgselectedOptions.

Using csAttendee.dgselectedOptions gives me an error when I try to
compile of Access of possibly undefined property dgselectedOptions
through a reference with static type mx.containers:Canvas.

If I try Attendees.csAttendee.dgselectedOptions gives me Access of
possibly undefined property csAttendee through a reference with
static type mx.containers:Canvas.

If I try just dgselectedOptions it compiles, but when I click my
payment button it gives: Cannot access a property or method of a
null object reference. Even though I can click on the Attendees tab
and the datagrid is there and populated.




Re: [flexcoders] Cairngorm’s Anaemic Domain M odel

2006-12-05 Thread Lachlan Cotter

On 05/12/2006, at 8:47 PM, Tom Chiverton wrote:


First, I have never seen examples or discussion of Cairngorm that
deals with this issue. In most cases the 'model' isn't much more than
a collection of dumb value objects without complex relationships.


I'm not sure you'd want your model to be very more complex.


Really? Maybe it's my upbringing but I seem to want this a lot. In  
particular, when you want to model relationships and connections  
between objects other than a simple containment type relationship. Or  
when you want to describe objects with behaviour rather than only data.



Second, and more importantly, pretty much all the logic of Cairngorm
apps seems to reside in the Command and Delegate classes with not
much to speak about in the actual model. It seems to be the Commands
that end up manipulating the application data directly, and I'm a
little uncomfortable with this.


I think it's a good idea to stick all the logic in once obvious  
place, and
then have that change the model, which uses data binding to make  
things

change in the view.


Seems to me that the one obvious place for logic related to the  
business domain is in the model. Not that commands aren't a good  
idea; and I have no problem with using binding to update the view.  
That's not really the issue. The issue is encapsulation of business  
logic and guidelines for architecting the distributed domain model.


Cheers,
Lach

Re: [flexcoders] Re: Cairngorm's Anaemic Domain Model

2006-12-05 Thread Lachlan Cotter

Thanks Alex,

One thing I'm looking for is validation that there is a need in some  
applications to construct an object graph of sorts to describe the  
model beyond an array of records to be CRUDed.  Surely I'm not alone  
here?


If that's the case, is there a best practice for going from value  
objects delivered from a service, to first class, intelligent model  
citizens in the domain? One thing I've found confusing about the  
Cairngorm approach is that models and value objects seem to be  
synonymous.


You thoughts?

Cheers,
Lach


On 05/12/2006, at 11:13 PM, Alex Uhlmann wrote:

there many ways to use Cairngorm. I agree with you completly, it's  
of vital importance to refactor the right functionality from both,  
views and commands into model objects that mean something to your  
use case. Then, this functionality can also be easier unit tested. …


However how your model is going to look like depends on your  
specific needs. Cairngorm doesn't tell you how to design your  
custom model or your custom view. It's the infractucture around that.


My blog entries around that, which Douglas pointed out, have the  
indent to show one possible route to go towards this direction.  
Nevertheless, it's difficult to show that in examples, since  
there's a tradeoff in completeness and complexity vs. easy to  
understand examples and most importantly...time.  ;)




Re: [flexcoders] Re: ListBase.as getting called after Drop to Datagrid--Preventing the Drop???

2006-12-05 Thread Lachlan Cotter
If you're defining your own drag-drop event handlers, I don't think  
you're supposed to use dropEnabled='true'; dropEnabled='true' means  
that the default handlers are used.


From 'Flex 2 Dev Guide':

dropEnabled

A Boolean value that specifies whether the control can be a drop target
that uses default values for handling items dropped onto it. The default
value is false, which means that you must write event listeners for the
drag events. When the value is true, you can drop items onto the control
by using the default drop behavior.


On 06/12/2006, at 4:33 AM, wayneposner wrote:


Hi Lach,

Nope...My component code looked liked:
mx:DataGrid id=cart dragEnabled=true dropEnabled=true
dragEnter=onDragEnter(event)/

Still haven't figured out what caused the problem.

Wayne




Re: [flexcoders] Could not resolve mx:Effect to a component implementation.

2006-12-05 Thread Lachlan Cotter

Hi Onur,

Um, just a guess but the problem might be that you are trying to  
instantiate the abstract effect base class when what you actually  
want to do is use one of the concrete subclasses; e.g. Fade, Resize,  
Blur etc. See mx.effect in the docs for more explanation of this.


Cheers,
Lach


On 06/12/2006, at 1:03 AM, Onur Ersen wrote:


Hi everybody,

I'm new to Flex and i have some code having mx:Effects in it.

I get error as

Could not resolve mx:Effect to a component implementation.

I've imported import mx.effects.Effect; but still having the
problem.

Could anyone help me with this?

Thanks in advance.




Re: [flexcoders] Re: ListBase.as getting called after Drop to Datagrid--Preventing the Drop???

2006-12-05 Thread Lachlan Cotter
As a point of interest, it seems that you can define drop event  
handlers even without dropEnabled='true'. Then you don't have to do  
the preventDefault thing.


On 06/12/2006, at 11:50 AM, Deepa Subramaniam wrote:

That’s actually not true. dropEnabled just indicates that a control  
allows items to be dropped into it, given that the data format of  
the items being dropped matches what the control expects. The  
default DragEvent handlers are used to handle the drag  drop  
operations, though you are always allowed to add your own event  
handlers to override the default behavior.




Re: [flexcoders] Re: BindSetter?

2006-12-05 Thread Lachlan Cotter
I think you're right Steve. I have asked myself the same question in  
the past and ended up using bindProperty… When you say function set  
():void or function get ():Something you're really telling the method  
to masquerade as a property, so it makes sense that you can treat it  
as such. I have used BindingUtils.bindProperty to bind a setter  
method and it seems to work.


Cheers,
Lach


On 04/12/2006, at 4:31 PM, Steve Hindle wrote:


Sorry for reply to myself - but this is driving me _nuts_! I can't
find an example of bindSetter with a 'real' accessor function with
either yahoo or google. And the example on the 'bindUtils' page at
adobe.com (stuck in the comments at the bottom) - doesn't bind to a
'function set blah'... (isn't that the _required_ to consider a
funciton/method a 'setter' ??) It just binds to a 'normal' function.

Anyway, I'm starting to think that 'bindSetter' is really a poorly
named 'bindFunction' and that _all_ properties - var OR accessor based
should be using bindProperty.

Can someone confirm/refute this and save my sanity please!

Thanks




Re: [flexcoders] FDS on the desktop?

2006-12-04 Thread Lachlan Cotter

Hi Benjamin,

Would you mind explaining how you go about using an embedded SWF in a  
desktop application. Is there an API for doing that kind of thing?


Cheers,
Lach

On 04/12/2006, at 6:23 PM, benjidudu wrote:


Hi,

I am doing a desktop application with an embedded swf. I'd like using
FDS but all I read is about mxml or swf files in the server along FDS.
Is it possible using FDS with swf files not on the FDS server? If yes,
how do you do that?

Thanks,

Benjamin.




Re: [flexcoders] Class-based model as a dataprovider

2006-12-04 Thread Lachlan Cotter

Hi John,

Sorry if I missed the point but I'm not entirely clear on what you're  
trying to do here. Do you want to unmarshal your XML into an object  
graph of custom classes? I don't understand how the multiple  
renderers comes into it. What is the XML describing? Is it a result  
set or something less regular?


With regard to point 2, I think anything can be a dataProvider if it  
implements one of the accepted interfaces. IList, ICollectionView etc.


Cheers,
Lach


On 04/12/2006, at 11:57 AM, John Mazzocchi wrote:


Hi, I need a hand here ...

I have an app which reads an XML file, shoves everything into an  
XMLListCollection and then renders the collection to a one-column  
datagrid. Each row of the datagrid uses a (state-based)  
customItemRenderer [don't get me started on the problems I've had  
with ViewStack-based approach].


Anyway, it seems to work fairly well ... but I've now been asked to  
take a slightly different approach. The XML needs to be shoved into  
an Object Model (a custom DOM), so that the same data can have  
multiple renderers/converters created in the future (not just  
renderToScreen)... renderToPDF, renderToCSV, etc. Now there are  
notes in the PDF docs on creating a Class-based model ... I figure  
I'm gonna create an array of Objects, each one typed as they need  
to be, you know Bool, Text, Graphics, customSetOfAttribs,  
whatever ... custom addItem and removeItem functions which use  
templates for each Object type.


1. Any comments on my methodology?

2. How do I assign an ActionScript class as a dataprovider (for a  
datagrid)?


Thanks.

Cheers
John




[flexcoders] Feature request: dependant bindings meta-data

2006-12-04 Thread Lachlan Cotter

Hi Adobe Team,

Is this the right forum to talk about Flex Builder features? I have  
often found myself in situations where it would be very handy to say  
something like this.


[Bindable] public var firstName:String;
[Bindable] public var lastName:String;

[Bindable(basedOn='firstName,lastName')]
public function get fullName ():String {
return firstName + ' ' + lastName;
}

The idea being that when a binding for firstName or lastName changes,  
the dependant binding fullName will also get fired. The only way I  
know to do this with the current tools is:


private var _firstName:String;
private var _lastName:String;

[Bindable] public function get firstName():String {
return _firstName;
}

public function set firstName(str:String):void {
_firstName = str;
dispatchEvent(new PropertyChangeEvent('fullNameChanged');
}

[Bindable] public function get lastName():String {
return _lastName;
}

public function set lastName(str:String):void {
_lastName = str;
dispatchEvent(new PropertyChangeEvent('fullNameChanged');
}

[Bindable(event='fullNameChanged')]
public function get fullName ():String {
return firstName + ' ' + lastName;
}

Which is obviously less expressive. It would be great to have a kind  
of 'based on' meta-data for bindings as in my example. Or is there a  
way to do this already that I don't know about?


Many thanks,
Lach

[flexcoders] List component and state change events

2006-12-04 Thread Lachlan Cotter
Hi,

I have a List control with custom item renderers. The renders have  
two alternate states and I am using a transition to move between them.

The problem seems to be that when the list is scrolled, state change  
events get fired on the renderers which have just come into view. I  
think I remember reading that the list controls only use enough  
renders to display the items which are actually visible at any point,  
so I am guessing it has something to do with this.

The consequence is that the transition gets fired on those renderers  
even though no actual state change has occurred.

Any ideas?

Cheers,
Lach



Re: [flexcoders] Function Error

2006-12-04 Thread Lachlan Cotter
Your validateForm() function tries to call a method on a variable  
which is null.  I'm not sure exactly where you have gone wrong as  
your example code is incomplete. Set a break point in the validateForm 
() function and run it in the debugger so you can which line throws  
the error.


Cheers,
Lach


On 05/12/2006, at 11:59 AM, jmfillman wrote:


When I click on the Submit button, I get the following error:

TypeError: Error #1009: Cannot acces a property or method of a null
object reference.
at main/validateForm()
at main/__btnFormSign_click()

What am I doing wrong?

mx: State name=Forms
mx:AddChild position=lastChild
mx:Canvas width=200 height=31 right=10 top=39
mx:Button label=Submit id=btnFormSign click=validateForm();
mx:Script
![CDATA[
[Bindable]
public var validationAC:ArrayCollection;

public function validateForm() :void {

if (text1.text.length  3) {
validationAC.addItem({label:Text1, data:false});
}
}
/mx:Script
/mx:Button
/mx:Canvas




Re: [flexcoders] Feature request? Ability to apply multiple states or views at once..

2006-12-03 Thread Lachlan Cotter
You can also create state objects on-the-fly with ActionScript. This  
allows you to paramatise the 'state of the state', which might be a  
more concise way to manage this task. Create / instantiate / modify  
your existing state object, then set it to be current.



On 03/12/2006, at 11:04 AM, Steve Hindle wrote:


Hi Dustin,

  It's 'based on' that actually 'teased' me with this...
As you start having more 'optional' things in the component  
('noNotes','noSaveButton',etc), you end up with a 'states  
explosion'...
'based on' gets about half-way there, so I figured it could be  
enhanced to handle the rest?
I could do it all by manually adding/removing child components, but  
that seems like overkill.


Thanks!




[flexcoders] Registering for events from an item renderer

2006-12-03 Thread Lachlan Cotter

Is there a better way?

The situation:

I have a list view displaying a collection of objects with item  
renderers. I want the list view to respond to state change events  
dispatched from the item renderers.


The solution (of sorts):

Created a new ClassFactory to instantiate the renderers which also  
registers a delegate (the list view) to receive the events.


Why this sucks:

It's heaps of code to do a tiny thing. Needed to define a factory  
class, an interface for the delegate to implement, an implementation  
of the interface and an event type class to carry a reference to the  
renderer.


Is there a better way?

Many thanks,
Lach

Re: [flexcoders] correct way to create rectangles ?

2006-12-02 Thread Lachlan Cotter

Hello Arpan,

There's nothing wrong with the way you have done it. Consider, if you  
create child components for each of the rectangles, you will have to  
create a new class and paramatise it so they know what colour to  
draw, then you will have to instantiate them, using up memory and  
cycles, then you will have to write code to position them and manage  
them. Is there any added value or functionality in that approach  
which justifies it versus what you have now?


One possible advantage is that you will get layering functionality.  
Do you need that?


There is some middle ground. You can create a class which manages the  
drawing of the rectangles but which isn't actually a sprite subclass.  
It could just be a regular object which you can use to draw within  
the context of your UIComponent. I have used this technique for  
instance to draw grid lines on a custom chart like component where I  
wanted to break up the drawing logic but didn't want to create sub- 
components.


The only reason for this is to manage complexity. What you have is  
perfectly valid. Remember to g.clear() at the beginning unless you  
want to smear your component when you move or resize it.


Cheers,
Lach


On 01/12/2006, at 6:51 PM, arpan srivastava wrote:


Hi,
I have to draw 5 rectangle inside a class extending  
UIComponent. I have done this :


// Draw first base rectangle
g.beginFill(baseRectColor1);
g.drawRect(0,baseY,bRW1,baseRectHeight);
g.endFill();

// Draw second base rectangle
g.beginFill(baseRectColor2);
g.drawRect(bRW1,baseY,bRW2,baseRectHeight);
g.endFill();

// Draw third base rectangle
g.beginFill(baseRectColor3);
g.drawRect(bRW2 + bRW1,baseY,bRW3,baseRectHeight);

g.endFill();


   is this approach ok or should I create new sprite object for  
each rectangle and add it to the class. ?




Re: [flexcoders] Problems with dynamic column series showDataEffect

2006-12-02 Thread Lachlan Cotter

Hi Dan,

I don't have any experience with charting components, but is there a  
way to test if the effects are triggered? Do you need to use an  
ArrayCollection instead of a plain array to manipulate the series  
information? I believe this makes a difference with binding-related  
behaviours.


Cheers,
Lach


On 25/11/2006, at 9:08 AM, daannnb wrote:


Hi All

I'm sorry to post this twice, but still no nearer to a solution, I'm
having a few problems assigning data effects to a dynamically
generated column series, while I can create a new series dynamically
ok, just don't seem to be able to get the showDataEffect to work, a
cut down version of the code that I'm using is below;

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute
mx:Script
![CDATA[
import mx.controls.CheckBox;
import mx.collections.*;
import mx.charts.*;
import mx.charts.series.*;
import mx.charts.renderers.*;
import mx.charts.events.*;
import mx.events.*;

// the datasource
[Bindable]
public var rs:ArrayCollection = new ArrayCollection([

{label:'Record One', interval1:20, interval2:30, interval3:40},

{label:'Record Two', interval1:37, interval2:56, interval3:41},

{label:'Record Three', interval1:10, interval2:15, interval3:79}]) ;

/**
* Add another column to chart
[EMAIL PROTECTED] Object - the checkbox event
*/
public function appendInterval(column:String):void
{
var series:ColumnSeries = new ColumnSeries() ;
series.xField = 'label' ;
series.yField = column ;
series.setStyle(showDataEffect, slideIn);
series.setStyle(hideDataEffect, slideOut);
var currentSeries:Array = resultchart.series;
currentSeries.push(series) ;
resultchart.series = currentSeries ;
}
]]
/mx:Script
mx:SeriesSlide id=slideIn duration=1000 direction=up/
mx:SeriesSlide id=slideOut duration=500 direction=down/

mx:Panel id=holder title=Result View width=100%
height=100% 
mx:ControlBar id=resultsControBar width=100%
paddingTop=0 paddingLeft=0 paddingBottom=0
mx:Spacer width=100% /
mx:Label text=Append Interval /
mx:CheckBox id=interval1 label=Interval 1
click=appendInterval('interval1')/
mx:CheckBox id=interval2 label=Interval 2
click=appendInterval('interval2')/
mx:CheckBox id=interval3 label=Interval 3
click=appendInterval('interval3')/
/mx:ControlBar

mx:ColumnChart id=resultchart dataProvider={rs}
width=100% height=100%
mx:horizontalAxis
mx:CategoryAxis categoryField=label/
/mx:horizontalAxis

/mx:ColumnChart
/mx:Panel

/mx:Application

Can anyone see what I'm doing wrong? Again, very sorry for the
double post

Regards

Dan




Re: [flexcoders] drawing a stack of rectangle ?

2006-12-02 Thread Lachlan Cotter

Hi Arpan,

What would you _like_ to have happen?


On 26/11/2006, at 5:52 PM, arpan srivastava wrote:


Hi,
 I am drawing a stack which contans rectangles of different  
depending on some value. rectangles are drawn but they are  
overlapping each other by 1 or 2 pixels at the end.


I have to highlight the rectangles also, for that I am creating a  
rectangle on mouseOver event and adding the rectangle on the same  
rectangle that I am highlighting, but this way the lower border of  
the highlighter gets covered by the rectangle below that.




[flexcoders] Cairngorm’s Anaemic Domain Model

2006-12-02 Thread Lachlan Cotter
Something that troubles me about the Cairngorm architecture is the  
apparent lack of any proper domain model. Although it is argued that  
the domain model actually exists on the server and that the Flex  
client is essentially a view, I have always found it necessary to  
construct some kind of object graph of the domain on the client as well.

I have two concerns regarding this.

First, I have never seen examples or discussion of Cairngorm that  
deals with this issue. In most cases the 'model' isn't much more than  
a collection of dumb value objects without complex relationships.

Second, and more importantly, pretty much all the logic of Cairngorm  
apps seems to reside in the Command and Delegate classes with not  
much to speak about in the actual model. It seems to be the Commands  
that end up manipulating the application data directly, and I'm a  
little uncomfortable with this.

I think Cairngorm’s a good method for managing code and iterative  
development, but I'm not sure about how well it does encapsulation  
and MVC.

Anyone care to discuss?

Cheers,
Lach


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 


Re: [flexcoders] Best practices for displaying large texts

2006-12-02 Thread Lachlan Cotter

Hi Pablo,

I'm not sure this is the best answer to your question but as far as I  
know the Text component is the right choice for displaying multi- 
line, non-editable text. If you want your users to be able to edit  
the text, you can use a TextArea instead.


I'm don't know of a way to do justified text in Flex. Sorry.

Lach

On 30/11/2006, at 12:15 AM, Pablo Apanasionek wrote:


Hey,

I'm trying to figure out the best (or at least optimal) way to  
display a large text (e.g. a news article) with several paragraphs  
using Flex 2. Would a Text control be the right one to use? Or is  
there another technique that would render better? Is there any way  
to justify text on -both- sides?


Thanks in advance,
Pablo Gustavo Apanasionek




Re: [flexcoders] printf similar function

2006-12-02 Thread Lachlan Cotter

Hi Misael,

That would be useful as ActionScript string concatenation operations  
are fairly clumsy with more than a few pieces. Unfortunately the AS  
String class doesn't seem to have such functionality. It's not so  
hard to roll your own, because you don't need to worry about the  
various types, you just need a single token and call toString() on  
all the arguments. Here's a sketch of something, but it's not very  
robust. You would have to add checking for zero-length arguments and  
other unexpected conditions. It might get a bit trickier also if you  
want to do various number formats like hexadecimal.


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;  
layout=absolute

creationComplete=testFormat()
mx:Script
![CDATA[
import mx.controls.Alert;

public function stringFormat (format:String, ... 
args):String
{
var parts:Array = format.split('%@');

// Parts should have one more element that args.
if (parts.length != args.length + 1)
throw new Error(Problem with your 
logic!);

var output:String = parts[0];

for (var i:Number = 0; i  args.length; i++) {
output += args[i].toString();
output += parts[i + 1];
}

return output;
}

public function testFormat ():void
{
var str:String = stringFormat(Test, %@, insertion, %@, of, %@  
vars,

42, 'a string', {prop:'test'});

Alert.show(str);
}
]]
/mx:Script
/mx:Application

Cheers,
Lach


On 07/11/2006, at 11:13 PM, Misael wrote:


Hi,

is there an utility class, function or anything in AS3 with similar  
functionality of C printf function? I need to format a string just  
like I do it with this function, along with all the capabilities  
which comes along (%d, %s, etc).


Thanks!




Re: [flexcoders] {data} current index

2006-11-30 Thread Lachlan Cotter

Hi Alex,

Item renderers aren't really aware of the wider context in which they  
are show (i.e. as one item in a collection). They are only concerned  
with how to render the particular data object that is passed to them.  
If you want to render some kind of index number on the view, your  
best bet is probably to incorporate it in the model somehow. That is,  
each item in your collection should have an index property which is  
set to equal its position in the collection.


Then you can say

mx:Text text={data.index}/

Cheers,
Lach



On 30/11/2006, at 2:22 AM, Alex wrote:


Hi,

I have an application that uses a custom component as a renderItem in
a TileList, retrieving a list of data from XML as the dataProvider.

How can I retrieve the current index of the item within my custom
component? I can retrieve the data using {data}, but how would I
retrieve the index of the item as it is being added in the actual
TileList?




Re: [flexcoders] Second problem: how to delete a component out of the storage

2006-11-30 Thread Lachlan Cotter

Hi Matze,

I'm curious how you are measuring the 5mb that is apparently leaked  
on each call to your pop-up.


Cheers,
Lach

On 30/11/2006, at 4:03 AM, matze.kueby wrote:


Hello,

My second question is how to delete a component out of storage.

We have some own components (basically forms), which will be created
and shown by an construct e.g.
var myComponent : T_Component = new T_Component ;
this.addChild(myComponent)

Some of our forms will be created in an popup. On every call of the
popup, we lost 5 mb or more, all childs on the windows will be
removed by formname.removeAllChild();
What cann we do, that the garbage collector will dispose this
objects.
Is there a way to show all objects with references (NOT NULL)?

I have read in the Flex Help, that this.removeChild(myComponent) not
delete the form and/or object out of the storage.
Rather the object must be destroyed.

It is sufficient to call delete(myComponent) about remove this object
out of the storage as the case may be that the garbage-collector
remove this object at any time?
Or how can I destroy a component correctly. What happens with the
widgets on this component e.g. input fields or datagrids?
Are they also being deleted?

Thanks for your help, too.

Matze




Re: [flexcoders] Newbie question: Showing a vertical scroll bar on application

2006-11-30 Thread Lachlan Cotter

Hi Flexy,

If you create a popup window using the PopupManager than it is not  
part of the normal view hierarchy and so it will not create scroll  
bars on the application object, even if it is placed partially out of  
the visible region. Pop-ups float above the main application window  
so they will not affect the size or scroll policy of that object at all.


From the docs:

The SystemManager maintains multiple lists of children, one each for  
tooltips, cursors, popup windows. This is how it ensures that popup  
windows float above the main application windows and that tooltips  
float above that and cursors above that. If you simply examine the  
numChildren property or call the getChildAt() method on the  
SystemManager, you are accessing the main application window and any  
other windows that aren't popped up. To get the list of all windows,  
including popups, tooltips and cursors, use the rawChildren property.


http://livedocs.macromedia.com/flex/2/langref/mx/managers/ 
SystemManager.html


If you want to scroll them around, perhaps popups are not really what  
you're after?


It is possible to show a scroll bar on the application object, but  
not through pop-ups.


Cheers,
Lach

On 27/11/2006, at 7:36 AM, Flexy wrote:


Hi,



I am adding titlewindows using the popupManager on the application  
canvas, I have many of them so some are beyond the screen height,  
However, no vertical scrollbar shows – how can I make sure the  
vertical scroll bar shows if there are controls beyond the screen  
height?




Thanks,



Flexy.




Re: [flexcoders] Question on itemRenderer

2006-11-30 Thread Lachlan Cotter

Hey Ben,

First off, if you're allowing your user to manipulate multiple  
objects at once, you might consider using the multiple selection  
abilities of the DataGrid (allowMultipleSelection=true) and allow the  
user to select the rows that way.


Second, if the action of a button is effecting multiple objects, it  
probably makes sense to have that button outside of the item  
renderer. Anything on the renderer would be assumed to be related to  
the object being rendered (not the collection).


Either way, you should have your button fire off some event to set  
the delete operation in motion. The code that handles that event  
(hopefully on some kind of controller, not the item renderer), should  
check which objects are selected, and include them in the data to the  
service call.


If your button is placed outside of the item renderer, then it can  
have a reference to the DataGrid as a whole and be able to find it's  
selectedItems property.


Does that answer your question?

Cheers,
Lach


On 25/11/2006, at 6:05 AM, bsdensmore wrote:


I have a DataGrid column that is using an itemRenderer to place a
checkbox in the Grid. This will allow someone to select multiple rows
to delete. I'm slowly starting to understand how to implement an
itemRenderer but still unclear on a couple of things.

After the user selects the rows they want to delete they will hit a
delete button which then triggers a function in the itemRenderer.

Should I get which rows were checked then pass those back to a
function in the Main application and delete the necessary rows or
handle it all in the function that is called in the itemRenderer?

I'm not actually deleting rows but I am calling a function in a CFC to
update the rows in a database and set their state back to something  
else.


Thanks,
Ben




[flexcoders] Disclosure triangles

2006-11-30 Thread Lachlan Cotter
Hi List,

Is it possible to use the disclosure triangle from the Tree view  
control outside of a tree view? I want to use it to switch between  
states on an item renderer (a collapsed, summary state, and a full,  
detail state). There doesn't seem to be a disclosure triangle component.

Cheers,
Lach



Re: [flexcoders] Disclosure triangles

2006-11-30 Thread Lachlan Cotter
I might end up having to go that way, but it would be preferable to  
use an existing framework component, if it exists, so the skin used  
on the button is that same as the skin used on the tree. Thanks for  
the suggestion.



On 01/12/2006, at 3:09 PM, Gordon Smith wrote:

Couldn't you use a Button that has 'toggle' set to true and skinned  
with triangle graphics?




- Gordon



From: flexcoders@yahoogroups.com  
[mailto:[EMAIL PROTECTED] On Behalf Of Lachlan Cotter

Sent: Thursday, November 30, 2006 5:38 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Disclosure triangles



Hi List,

Is it possible to use the disclosure triangle from the Tree view
control outside of a tree view? I want to use it to switch between
states on an item renderer (a collapsed, summary state, and a full,
detail state). There doesn't seem to be a disclosure triangle  
component.


Cheers,
Lach




Re: [flexcoders] Text instance does not calculate its height properly when in scrollable Box

2006-11-29 Thread Lachlan Cotter

Hi Sergey,

I'm not sure what you mean by 'cut by mask'. Is the text being  
obscured? When I tried your example code it performed as expected  
without issues.


Cheers,
Lach


On 27/11/2006, at 10:25 PM, Sergey Kovalyov wrote:


Hi All!

When Text instance is in scrollable Box and user scrolls vertical
scrollbar to the bottommost position, bottom edge of the Text remains
invisible (cut by mask). How to fix it? Look at the example below that
reproduces this behavior:




Re: [flexcoders] Binding to a custom method: possible?

2006-11-29 Thread Lachlan Cotter

Hi Ben,

Your problem is probably that you have not told Flex when it needs to  
fire the binding. The binding mechanism works by broadcasting events  
from the setter methods of bindable properties. If there is no direct  
setter involved, then Flex does not automatically know to refresh the  
data to the binding destination.


The best way I know around this issue is to specify the event type  
you want to associate with a change to your calculated value, and  
then fire that event when ever any of the arguments to that method  
change.


[Bindable(enabledParamsChanged)]
private function isEnabled():Boolean {
if (A) … if (B) … etc
}

Then you need to say something like

private function set valueOfA (arg) {
// Change A here
dispatchEvent(new Event(enabledParamsChanged));
}

private function set valueOfB (arg) {
// Change B here
dispatchEvent(new Event(enabledParamsChanged));
}

Now Flex knows to fire your isEnabled binding when the arguments to  
the calculation are altered.


Cheers,
Lach


On 29/11/2006, at 1:13 AM, ben.clinkinbeard wrote:


There was a similar question asked here recently but my needs are
different so I am starting a new thread. My needs are as follows: I
have a ComboBox whose enabled state needs to be determined by several
factors, thus the need for a custom method. The problem is that this
doesn't seem to work, no matter how I try it. Am I missing something
or is this just not possible (meaning I have to set a property and
bind to that)? Fake sample code below:

[Bindable]
private function isEnabled():Boolean
{
if(conditionA)
{
if(conditionB)
{
return true;
}
else
{
return false;
}
}
}

mx:ComboBox id=cb enabled={isEnabled()}/

Thanks,
Ben




Re: [flexcoders] displaying an array result as a pop up dialog

2006-11-29 Thread Lachlan Cotter

Sounds like you want to say:

Alert.show(your message here)

That will give you a simple pop-up with your confirmation text.

If you want to use a custom component for your pop-up, investigate  
the PopupManager class.


Cheers,
Lach


On 28/11/2006, at 10:41 PM, munene_uk wrote:


I have built a simple mail application that allows the user to send a
message to multiple users. once the message is successfully sent it
returns a message i.e the message has been sent to the following
recipients [EMAIL PROTECTED], [EMAIL PROTECTED] e.t.c

the issue is that this data is returned as an array on this function
in which i am using a textbox to display the results, however i would
like to use an alert box to display the results instead.

public function onSendResult(result:Array):void{

var str:String = result.toString();

string_res.htmlText= str;

}

how would i go about doing this?




Re: [flexcoders] application structure and proper practice

2006-11-29 Thread Lachlan Cotter

Hi,

That is an architecture question so it depends on how you have  
decided delegate responsibilities in your application. As a general  
guide however: your pop-up windows are views and should be separated  
from (have no knowledge of) the service calls which are an interface  
to the application layer.


A typical way to achieve this is to broadcast events from your view  
describing user interactions (e.g. user submits form) passing the  
object to which the form is bound as the event 'payload'. Listen for  
these events with your controller and use your event handler to call  
the webservice or respond as appropriate.


Your view needn't know anything about the webservice.

Hope that helps.

Cheers,
Lach


On 29/11/2006, at 4:42 AM, bghoward3 wrote:


i am in the middle of developing an application with several popup
windows that a user can populate and send to a db, i am wondering what
the best practice is here in regards to my webservice calls.

is it best to keep all of my REQUESTES TIED TO THE WEBSERVICE STORED
IN THE PARENT DOCUMENT AND USE FUNCTIONS to interact with the service
or should i initate new webservice calls within the pop up window?

thanks for any direction on the correct practice to follow




Re: [flexcoders] application structure and proper practice

2006-11-29 Thread Lachlan Cotter

Hi,

That is an architecture question so it depends on how you have  
decided delegate responsibilities in your application. As a general  
guide however: your pop-up windows are views and should be separated  
from (have no knowledge of) the service calls which are an interface  
to the application layer.


A typical way to achieve this is to broadcast events from your view  
describing user interactions (e.g. user submits form) passing the  
object to which the form is bound as the event 'payload'. Listen for  
these events with your controller and use your event handler to call  
the webservice or respond as appropriate.


Your view needn't know anything about the webservice.

Hope that helps.

Cheers,
Lach


On 29/11/2006, at 4:42 AM, bghoward3 wrote:


i am in the middle of developing an application with several popup
windows that a user can populate and send to a db, i am wondering what
the best practice is here in regards to my webservice calls.

is it best to keep all of my REQUESTES TIED TO THE WEBSERVICE STORED
IN THE PARENT DOCUMENT AND USE FUNCTIONS to interact with the service
or should i initate new webservice calls within the pop up window?

thanks for any direction on the correct practice to follow




Re: [flexcoders] Built-in way to determine the number of XML elements

2006-11-29 Thread Lachlan Cotter

Why don't you just test the length of the matches element?

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;  
layout=absolute creationComplete=output()

mx:Script
![CDATA[

[Bindable]
private var xml1:XML = root
matches/
/root;

[Bindable]  
private var xml2:XML = root
matches
match/
/matches
/root;

private function output ():void
{
r1.text = 
XML(xml1.matches).child('match').length().toString();
r2.text = 
XML(xml2.matches).child('match').length().toString();
}

]]
/mx:Script

mx:VBox

mx:Label text=First Result/
mx:TextInput id=r1/

mx:Label text=Second Result/
mx:TextInput id=r2/

/mx:VBox

/mx:Application



On 29/11/2006, at 7:56 AM, Daniel Thompson wrote:

I'm trying to see if a response from the server is empty. So, in  
one case I

end up with:

root
matches/
/root

And in the other, I get:

root
matches
match ... /
/matches
/root

Using this fancy E4X, how do I test for the different conditions? I  
always
seem to be getting back an XMLList, be it empty or not. I can't  
imagine I
have to iterate this and check that it's zero at the end, but  
length doesn't
do it, and I can't check for null because I'm always getting an  
XMLList.


Thanks,
-DT









[flexcoders] Object serialisation + SimpleXMLEncoder

2006-08-17 Thread Lachlan Cotter


Hi List,I want to be able to serialise and de-serialise ActionScript objects to XML so they can sent to a server application. I would prefer to write a method for this once that can handle any object. Unfortunately, the introspection API is sadly wanting (doesn't report private members), which makes it insufficient for this purpose. The SimpleXMLEncoder apparently does this, but I can't work out how to use it. Can anybody point me to some examples or offer suggestions for alternative methods?This code produces errors:var myObj:TestClass = new TestClass;var doc:XMLDocument = new XMLDocument;var coder:SimpleXMLEncoder = new SimpleXMLEncoder(doc);var node:XMLNode = coder.encodeValue(myObj, ("" as QName), doc);trace(node.toString());What am I doing wrong?Cheers,Lach
__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___


[flexcoders] Initialization of MXML components

2006-08-07 Thread Lachlan Cotter


Hi List,I have a question about the initialisation rules for MXML components. My situation is as follows:I have defined a custom MXML component that extends the Canvas class (myComponent).MXML root node of the file, I put a Text element, assigning it an ID (myText).I define a setter method on this class (myProperty) that takes a String argument and passes it to myText.text.I use the custom component in the application, with a tag like this:local:MyComponent myProperty="a value" /Sure enough the instance is created and the setter method is called. However, an error results when I try to access the property of the child Text object. Apparently it has not been initialised when the method is called. This results in an error (setting a property on a null object).My question is if this is the expected behaviour and if there is a way to achieve this with MXML (setting properties of child objects from a setter method called at init time).Thanks for any insights.Cheers,Lach 
__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___