[flexcoders] BrowserManager crossdomain issues

2009-08-31 Thread david.keutgens
Hi All,

I'm trying to host the html-template files provided by Flex Builder (including 
all necessary JavaScript) on one domain (www.mydomain.com) and the embedded 
SWF on another (swf.mydomain.com).

Now, even though I call Security.allowDomain(*.mydomain.com) in my Flex app 
and allowScriptAccess=always in the embedding html, FlashPlayer complains 
about a SecurityViolation in flashlog.txt. It actually happens as soon as I hit 
the browser's back button. 

Firebug reports: uncaught exception: Error calling method on NPObject! [plugin
exception: Error in Actionscript. Use a try/catch block to find
error.].
The exception gets thrown in the setTitle function in history.js.

Crossdomain files don't seem to be the issue, they're set up and working fine 
for other content.

I cannot really find any reference of others who tried this before, does anyone 
know if it is actually possible at all to host the history related JavaScript 
in a different domain than the SWF?





[flexcoders] Re: BrowserManager crossdomain issues

2009-08-31 Thread david.keutgens
Hi Alex,

This is a SWF compiled with Flex SDK 3.3 running in Firefox 3.5. The 
BrowserManager code works fine when the HTML/JavaScript and SWF are hosted in 
the same domain, only separating them breaks it.

Thanks,
David



--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Which browser?  Might be an issue with HistoryFrame.html on IE?
 
 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of david.keutgens
 Sent: Monday, August 31, 2009 5:05 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] BrowserManager crossdomain issues
 
 
 
 Hi All,
 
 I'm trying to host the html-template files provided by Flex Builder 
 (including all necessary JavaScript) on one domain (www.mydomain.com) and 
 the embedded SWF on another (swf.mydomain.com).
 
 Now, even though I call Security.allowDomain(*.mydomain.com) in my Flex app 
 and allowScriptAccess=always in the embedding html, FlashPlayer complains 
 about a SecurityViolation in flashlog.txt. It actually happens as soon as I 
 hit the browser's back button.
 
 Firebug reports: uncaught exception: Error calling method on NPObject! 
 [plugin
 exception: Error in Actionscript. Use a try/catch block to find
 error.].
 The exception gets thrown in the setTitle function in history.js.
 
 Crossdomain files don't seem to be the issue, they're set up and working fine 
 for other content.
 
 I cannot really find any reference of others who tried this before, does 
 anyone know if it is actually possible at all to host the history related 
 JavaScript in a different domain than the SWF?





[flexcoders] Re: BrowserManager crossdomain issues

2009-08-31 Thread david.keutgens
Both domains are https. Yeah, I'll use the debugger but I get the impression 
that this is a Flash Player security restriction.

-David


--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Is one domain https and the other http?  Are you calling setTitle in your 
 code?  Maybe debug through that to see what is going on.
 
 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of david.keutgens
 Sent: Monday, August 31, 2009 4:09 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: BrowserManager crossdomain issues
 
 
 
 Hi Alex,
 
 This is a SWF compiled with Flex SDK 3.3 running in Firefox 3.5. The 
 BrowserManager code works fine when the HTML/JavaScript and SWF are hosted in 
 the same domain, only separating them breaks it.
 
 Thanks,
 David
 
 --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Alex 
 Harui aharui@ wrote:
 
  Which browser? Might be an issue with HistoryFrame.html on IE?
 
  Alex Harui
  Flex SDK Developer
  Adobe Systems Inc.http://www.adobe.com/
  Blog: http://blogs.adobe.com/aharui
 
  From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com 
  [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] On 
  Behalf Of david.keutgens
  Sent: Monday, August 31, 2009 5:05 AM
  To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com
  Subject: [flexcoders] BrowserManager crossdomain issues
 
 
 
  Hi All,
 
  I'm trying to host the html-template files provided by Flex Builder 
  (including all necessary JavaScript) on one domain (www.mydomain.com) and 
  the embedded SWF on another (swf.mydomain.com).
 
  Now, even though I call Security.allowDomain(*.mydomain.com) in my Flex 
  app and allowScriptAccess=always in the embedding html, FlashPlayer 
  complains about a SecurityViolation in flashlog.txt. It actually happens as 
  soon as I hit the browser's back button.
 
  Firebug reports: uncaught exception: Error calling method on NPObject! 
  [plugin
  exception: Error in Actionscript. Use a try/catch block to find
  error.].
  The exception gets thrown in the setTitle function in history.js.
 
  Crossdomain files don't seem to be the issue, they're set up and working 
  fine for other content.
 
  I cannot really find any reference of others who tried this before, does 
  anyone know if it is actually possible at all to host the history related 
  JavaScript in a different domain than the SWF?
 





[flexcoders] Re: Remove mx:Binding

2008-12-14 Thread david.keutgens
Hi Amy,

as far as I know there is no way to remove a Binding that has been
created via an mx:Binding tag. To be able to remove Bindings, you can
keep track of ChangeWatchers that have been created in AS (instead of
MXML) via BindingUtils.bindProperty/bindSetter and remove them with a
call of ChangeWatcher.unwatch. E.g. Store your ChangeWatchers in an
array - unwatch and remove one or all of them when needed.

Example:

var watchers : Array = [];
var cw : ChangeWatcher = BindingUtils.bindProperty(...);
watchers.push(cw);

ChangeWatcher(watchers.pop()).unwatch();

If you can change the code of your super class, use BindingUtils
instead of mx:Binding and remove the ChangeWatchers in the subclass.

-- 
david keutgens
software consultant
cynergy australia

web | http://www.cynergysystems.com



--- In flexcoders@yahoogroups.com, amywongwy amywon...@... wrote:

 Hi,
 
 Is there a way to remove the mx:Binding tag?
 
 In the super class, I have this mx:Binding like this:
 mx:Binding source=getText()destination=testText/
 
 I would like to remove it in the subclass, is there a way that I can
 remove it?
 
 Cheers,
 Amy





[flexcoders] Re: Applying metadata in the middle of mxml - is it possible?

2008-12-11 Thread david.keutgens
--- In flexcoders@yahoogroups.com, per.olesen [EMAIL PROTECTED] wrote:

 Hi,
 
 Basically, I would like to apply some (of my own) metadata to a
 component instance inside the mxml. Like this:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:ApplicationControlBar
 
 mx:Metadata[MyMetadata]/mx:Metadata
 mx:Button id=foo label=Blah/
 
   /mx:ApplicationControlBar
 /mx:Application
 
 And then only have the [MyMetadata] applied to the foo button
 instance. Is this possible? Placing it there makes the compiler bark.
 I guess this is due to the fact, that mxmlc will put it before a class
 definition.
 
 I then tried something like this:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:ApplicationControlBar
 
 mx:Script[MyMetadata]/mx:Script
 mx:Button id=foo label=Blah/
 
   /mx:ApplicationControlBar
 /mx:Application
 
 but this made the compiler bark too :-) about metadata requiring an
 associated definition. And of course it is right. My guess is the
 mxmlc compiler is translating the above to something like:
 
 acb = new ApplicationControlBar();
 [MyMetadata]
 b = new Button();
 acb.add(b);
 
 and of course then it is wrong with the metadata element there. Am I
 right?
 
 Can I do it some other way?
 
 I came up with this:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:ApplicationControlBar
 
 myns:MetadataButton id=foo label=Blah/
 
   /mx:ApplicationControlBar
 /mx:Application
 
 and then have a component MetadataButton.mxml with this content:
 
 ?xml version=1.0 ?
 mx:Button xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:Metadata[MyMetadata]/mx:Metadata
 /mx:Button
 
 which works! But the MyMetadata annotation will change on the various
 buttons. So I would like to inline it, like this:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:ApplicationControlBar
 
   mx:Button xmlns:mx=http://www.adobe.com/2006/mxml;
 mx:Metadata[MyMetadata]/mx:Metadata
   /mx:Button
 
   /mx:ApplicationControlBar
 /mx:Application
 
 but this makes the compiler bark again.
 
 Any help?


Hi Per,

You can tell the compiler to accept custom metadata tags by using the
keep-as3-metadata compiler flag. You'll have to add it to your
compiler options. See
http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html
for details.

I hope that helps.

-- 
david keutgens
software consultant
cynergy australia

web | http://www.cynergysystems.com



[flexcoders] Re: Flex 2: rotating text

2008-12-07 Thread david.keutgens
--- In flexcoders@yahoogroups.com, simonjpalmer [EMAIL PROTECTED]
wrote:

 I have the requirement for a button which has text writton on it like
 the spine of a book, so rotated clockwise by 90 degrees.
 
 I have been looking at threads about text rotation but haven't found
 anything which exactly matches my requirement.  Anyone know how to do
 this in Flex 2?  Or know of a component I can grab which does it?
 
 TIA
 Simon


Hey Simon,

a very simple solution would be to create a custom Button class that
extends mx.controls.Button.

In that class you could override the createChildren method to rotate
the internal textField (it's a protected member of the Button class
that is used to render the button's label).

Example:

override protected function createChildren():void
{
super.createChildren();

if (textField)
{
   textField.rotation = 15;
}
}

Note that this will probably mess with the component's measurements.
You might have to override the measure method as well to make sure
that your button component delivers correct sizes.

-- 
david keutgens
software consultant
cynergy australia

web | http://www.cynergysystems.com.au



[flexcoders] Re: Fwd: Filtering the List Entries depending upon the text entered in text Input box

2008-12-04 Thread david.keutgens
--- In flexcoders@yahoogroups.com, anuj181 [EMAIL PROTECTED] wrote:

 --- In flexcoders@yahoogroups.com, anuj181 anuj181@ wrote:
 
 Hi All
 This is somehow regarding the question I have asked few weeks back.
 Unfortunately I have to stop this task at that time and now need to
 work on that. My need is that I have some entries in the List as an
 arrayCollection and there is text input box and I like to have list to
 filter the data as soon as user starts typing text. I have attached
 the so far developed code. I need as soon as user types On, the list
 below should only show first entry which is 'One-Device'. I attached
 the code but it is not working as I want. This is going to be just my
 dummy working prototype and once this module has been made working
 then i am going to merge this module into my Main Project.
 
 Also if anyone has any better idea about how to figure this thing out
 that will be great and instead of arrayColection if we can achieve the
 same function laity that would be helpful too.
 Thanks a lot
 Anuj 
 
 /**CODE/
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
   layout=absolute
   initialize=init() 
   width=100% height=100%
   horizontalScrollPolicy=off
 mx:Script
   ![CDATA[   
   
 import mx.managers.PopUpManager;
 import mx.effects.DefaultTileListEffect;  
 import mx.rpc.events.ResultEvent;
 import mx.controls.Alert;
 import mx.collections.ArrayCollection;
 import mx.effects.easing.Elastic;
 
 [Bindable]
 public var ac:ArrayCollection = new

ArrayCollection([One-Device,Two-Device,Three-Device,Four-Device,Five-Device,Six-Device]);
   
 [Bindable]
 public var filterText:String = '';
   
   private function doChange():void
 {
 this.filterText = txtSearch.text;
 this.ac.refresh();
 }
 
 private function init():void
 {
 ac.filterFunction = processFilter; 
 }
 private function processFilter(item:Object):Boolean
 {
   var result:Boolean=false;
   if(!DevicesList.labelField.length ||

DevicesList.labelField.toUpperCase().indexOf(this.filterText.toUpperCase())=0)
   result=true;
   
   return result;
 }
 private function seeLabel(evt:Event):void
 {
   var alrt:Alert=Alert.show(evt.currentTarget.toString());
 }
 
   ]]
 /mx:Script
   mx:List x=74 y=228 width=229 height=238 dataProvider={ac}
 id=DevicesList/mx:List
   mx:TextInput x=74 y=198 id=txtSearch change=doChange()/
   
   
 /mx:Application
 
 --- End forwarded message ---



When a collection gets filtered, the filter function is applied to
each item of a collection separately. So the passed parameter for the
filter function is always an item of your collection. In your case the
collection contains strings. The filter function receives the string,
all you have to do in the function is to compare it to your filterText
string.

To do that Josh casted the passed parameter as a string to compare it
to the filterText variable.

-- 
david keutgens
software consultant
cynergy australia

web | http://www.cynergysystems.com.au