Re: [Flashcoders] Re: unsubscribe

2014-09-24 Thread Jens Struwe

haha!! :five

On 24.09.2014 18:10, Kurt Griffin wrote:

Thanks man, that was the funniest thing I’ve seen all day.

-
Kurt Griffin
Software Development and Consulting
617.347.7681
http://www.squidfight.com




On Sep 24, 2014, at 12:00 PM, flashcoders-requ...@chattyfig.figleaf.com wrote:


unsubscribe


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] swf 2 pdf on the fly

2011-10-28 Thread Jens Struwe

I have recently tested these two libs:

- alivepdf
- purepdf

I ended up using alivepdf. Smaller lib size, better documented and it 
worked with the first set up.


The code to provide the download link:

import flash.events.IOErrorEvent;
import flash.net.FileReference;
...

var fileName : String = _fileName + .pdf;

try {
var f : FileReference = new FileReference();
f.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
f.save(_pdf.save(Method.LOCAL), fileName);
} catch (e : Error) {
trace (COULD NOT SAVE PDF);
}

...

private function ioErrorHandler(event : IOErrorEvent) : void {
trace (PERHAPS THE DOCUMENT IS OPEN);
}




Am 28.10.2011 14:56, schrieb Rodrigo Augusto Guerra:

hi all,

I have a flash swf that generates a report inside a mc then print it. ok. now 
my client wants a button 'save to pdf.' not just print...

The more automated the better, I wonder if someone has any hint on this, some 
tool that I can install on th server and it does that for me ...

thanks,
rodrigo
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] AS3Commons UI - Layouts, LifeCycle, Popups, Tooltips

2011-06-10 Thread Jens Struwe

Hi @coders,

hope you will like the project and hence push a message here:

AS3Commons UI is a collection of independent non-visual components, 
managers and algorithms to solve common user interface related tasks 
such as as layouting, focus and keyboard management, popup handling, 
drag and drop control and so on. To goal of the project is to provide 
functionality that deals with any kind of display object and does not 
require users to implement custom interfaces or extends base classes for 
their interface components.


AS3Commons UI is right now in version 0.3 which means that 3 planned 
packages are finished and stable.


1. Layouts
Different layout algorithms (single line, multiline, table)
http://sibirjak.com/osflash/projects/as3commons-ui/layouts/

2. Invalidation  LifeCycle
Component init and update management
http://sibirjak.com/osflash/projects/as3commons-ui/invalidation-lifecycle/

3. Layers
Generic popup and tooltip management solution
http://sibirjak.com/osflash/projects/as3commons-ui/layers/

Let me know if this project is useful to you or if you have some 
suggestions. Contribution is welcome and encouraged.


Best regards,

Jens



Further links:

AS3Commons Organization: http://as3commons.org/
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] using this in AS3 classes?

2011-06-08 Thread Jens Struwe
You need the this in any case the scope of the variable or method is not 
clear. In all other cases the this is not necessary. I don't use it. 
Tools such as FDT highlight instance properties differently to local or 
argument variables. This makes it easy to visually detect the scope of a 
property even if no this is in use.


public var value : String = ;

public function setValue(value : String) : void {
   this.value = value;
}


Am 08.06.2011 08:06, schrieb Cor:

Micky,

There are no stupid questions!
Only stupid people who don't ask their question... and yes, there are stupid 
answers. :-)

As for the prefix, IMO it is unnecessary, but some people find it easier to 
read their code.
I'll will not call myself a pro, but I never use it.

HTH,
Cor


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Micky Hulse
Sent: woensdag 8 juni 2011 6:55
To: Flash Coders List
Subject: [Flashcoders] using this in AS3 classes?

Hi,

Stupid question, but...

Let's say I have some class properties:

private var _mc1:MovieClip;
private var _mc2:MovieClip;

... and methods:

private function baz():void { ... }
private function foo():void { ... }

In my code, would it be overkill to always reference the above examples with a prefix of 
this?

For example:

this._mc1 = ...;
this._mc2 = this.mc1;
this.baz();
this.foo();

I could easily do this instead:

_mc1 = ...;
_mc2 = mc1;
baz();
foo();

Sorry if silly question, I am just kinda wondering what the pros do. :)

Best practices?

Thanks!
Micky
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem embedding and using a font variant

2011-04-12 Thread Jens Struwe

Don't ask me for details, but just a week ago I got this running.

[Embed(source=myfont.otf, fontFamily=myfont, 
mimeType=application/x-font-opentype)]

public var MyFont : Class;

To support otf, it is necessary to tell the compiler the a certain font 
manager is to use. I put it into my build.xml, but its easy to find the 
according command line option in the docs.


mxmlc
file=${SRC}/Movie.as
...


fonts
manager class=flash.fonts.AFEFontManager/
/fonts
...

That's not all, you need to compile with the Free SDK not the Open 
Source SDK. The reason is, that the AFEFontManager is not open source 
and not included into the Open Source SDK. Took me a while to find it out.


Best,

Jens



Am 12.04.2011 08:04, schrieb Merrill, Jason:

Also, what is the font extension?  I have found fonts with an .otf extension 
(like MyriadPro-Regular.otf) don't seem to embed with code.  TTF fonts work for 
me though,  could that be the issue?  Also, in Flex (can't recall in the Flash 
framework off the top of my head), when you embed fonts, there is an option to 
embedAsCFF - if something like that is available, try toggling true or false, 
sometimes that makes a difference.  Lastly, if your font is otf or something 
non-TTF, there are some Myriad fonts for free out there that have the .ttf 
extension, you could try downloading one of those instead.

  Jason Merrill
  Instructional Technology Architect
  Bank of America  Global Learning





___


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason
Sent: Monday, April 11, 2011 3:11 PM
To: Flash Coders List
Subject: RE: [Flashcoders] Problem embedding and using a font variant


Well, the textField as library symbol will work fine -


I believe the font embedding works differently with library symbols, but I 
could be wrong.

  Jason Merrill
  Instructional Technology Architect
  Bank of America  Global Learning





___


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Matt Perkins
Sent: Monday, April 11, 2011 3:04 PM
To: Flash Coders List
Subject: Re: [Flashcoders] Problem embedding and using a font variant

Well, the textField as library symbol will work fine - I tested that, but would 
rather keep it pure AS.


On Mon, Apr 11, 2011 at 2:56 PM, Merrill, Jason  
jason.merr...@bankofamerica.com  wrote:


I have found every now and then certain fonts don't play well with
Flash and there isn't much you can do if they don't work.  There are a
few fonts I have which simply don't embed, and the failure is silent.

  Jason Merrill
  Instructional Technology Architect
  Bank of America  Global Learning





___


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com [mailto:
flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Matt Perkins
Sent: Monday, April 11, 2011 2:25 PM
To: Flash Coders List
Subject: [Flashcoders] Problem embedding and using a font variant

I'm using Myriad Pro for regular (non TLF) dynamic text fields in my
project and it's working fine. Now the client wants to use Myriad Pro
Condensed Bold for titles and I cannot get it to show up. I can't get
just Myriad Pro Condensed to show either. I don't have any problems
with Myriad Pro - I think the condensed variant/style is causing
issues. I've checked over and over that I have it embedded properly.

Looks like Condensed Bold is treated as a style like bold but
there's no way to set a style on a text format object.

I even tried setting the font style via html in the text content:
textfild.htmlText = font face='Myriad Pro
Condensed'+mytext+/font; Didn't work.

Any tips for using font variants like this? I'd rather keep doing it
dynamically like this and not have to create a textfield symbol in the
library to use (which would work). Also, this is an AS3/CS5 project.

The TLF TextLayoutFormat has a font style property, but not sure if it
would work - but the last time I tried to use TLF my FLA wouldn't
compile because of some error with my assets SWC and the TLF SWC. So
I'd rather not go there.

Maybe I can fake it by tweaking the scaleX property.

Thanks,
Matt
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

--
This message w/attachments (message) is intended solely for the use of
the intended recipient(s) and may contain information that is
privileged, confidential or proprietary. If you are not an intended
recipient, please notify the sender, and then please delete and
destroy all copies and attachments, and be advised that any review or
dissemination of, or the taking of any action in reliance 

Re: [Flashcoders] Wait for several things to be loaded

2011-03-17 Thread Jens Struwe

It does not look that bad.

Since you know how many items have to be load, you may engage a counter:

private function handleComplete(e:Event) {
  _loadCount++;
  if (_loadCount == 2) {
 dispatchEvent(new Event(Event.COMPLETE));
  }

}

:-)

Am 18.03.2011 02:09, schrieb Mattheis, Erik (MIN-WSW):

I'm building an AIR app following the MVC pattern. Several parts of the model 
have to be loaded or created before the view can be initialized. I'm doing it 
like this - which works, but seems clunky. Is there a better way? From the main 
class of the model:

public function Model() {

   _database = new Database();
   _database.addEventListener(Event.COMPLETE, handleComplete);
   _database.init();

   _siteData = new SiteData();
   _siteData.addEventListener(Event.COMPLETE, handleComplete);
   _siteData.init();

  }

private function handleComplete(e:Event) {

   if (e.target is SiteData) {
  _siteDataLoaded = true;
   }
   else if (e.target is Database) {
 _databaseLoaded = true;
   }

if (_siteDataLoaded  _databaseLoaded) {
  dispatchEvent(new Event(Event.COMPLETE));
   }

}

_ _ _
Erik Mattheis | Weber Shandwick
P: (952) 346.6610
M: (612) 377.2272
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem with XML.childIndex()

2011-02-17 Thread Jens Struwe

Try:

var res : XMLList = _assets.child(number).(text() == prop);
var res:XMLList = _assets.*.(attribute(icon) == String(prop));

Jens


Am 17.02.2011 11:08, schrieb Glen Pike:

Hi,

I am having a problem with getting the childIndex value from an e4x result:

Both these functions work - e.g. they return an XML node from a list,
but the childIndex property always traces as -1 for the first function.

Can anyone see what the problem is?

TIA

Glen

public function getAssetDetails(prop:*):XML {
if (!_assets) {
return null;
}
var res:XMLList = _assets.(child(number) == String(prop));
if (0 != res.length()) {
debug(this, getAssetDetails  + res[0].childIndex());
return res[0];
} else {
return null;
}
}

override public function getAssetDetails(prop:*):XML {
if (!_assets) {
return null;
}
var res:XMLList = _assets.(attribute(icon) == String(prop));
if (0 != res.length()) {
debug(this, getAssetDetails  + res[0].childIndex());
return res[0];
} else {
return null;
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem with XML.childIndex()

2011-02-17 Thread Jens Struwe

May I refine your question?

I have an XML tree. How can I select nodes depending on the value of 
subnodes or the value of subnode attributes.


Anyway, you should provide a simple test XML that does not work.

Here my next try. When I understand right then you want to select assets 
depending on their number or icon. To make it even more illustrative, I 
have nested the asset values within a data tag.


private var _assets : XML =
assets
asset
data
number1/number
item icon=topTOP/item
/data
/asset
asset
data
number2/number
item icon=rightRIGHT/item
/data
/asset
asset
data
number3/number
item icon=bottomBOTTOM/item
/data
/asset
asset
data
number4/number
item icon=downDOWN/item
/data
/asset
/assets
;

public function XMLTest() {
trace(_assets.*.(data.number == 2));
trace(_assets.*.(data.*.@icon == down));
}




Am 17.02.2011 12:58, schrieb Glen Pike:

Hmm, they just return the number node from a matching asset in the
list, but if I do this:

var res : XMLList = _assets.child(number).(text() == prop);
if (0 != res.length()) {
trace(this, getAssetDetails  + res[0].parent().childIndex());
return res[0].parent();
}

I still have the same problem even using the parent???


On 17/02/2011 11:24, Jens Struwe wrote:

Try:

var res : XMLList = _assets.child(number).(text() == prop);
var res:XMLList = _assets.*.(attribute(icon) == String(prop));

Jens


Am 17.02.2011 11:08, schrieb Glen Pike:

Hi,

I am having a problem with getting the childIndex value from an e4x
result:

Both these functions work - e.g. they return an XML node from a list,
but the childIndex property always traces as -1 for the first function.

Can anyone see what the problem is?

TIA

Glen

public function getAssetDetails(prop:*):XML {
if (!_assets) {
return null;
}
var res:XMLList = _assets.(child(number) == String(prop));
if (0 != res.length()) {
debug(this, getAssetDetails  + res[0].childIndex());
return res[0];
} else {
return null;
}
}

override public function getAssetDetails(prop:*):XML {
if (!_assets) {
return null;
}
var res:XMLList = _assets.(attribute(icon) == String(prop));
if (0 != res.length()) {
debug(this, getAssetDetails  + res[0].childIndex());
return res[0];
} else {
return null;
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem with XML.childIndex()

2011-02-17 Thread Jens Struwe

Thanks for the XML. Given this, the method works as expected:

getAssetByNumber(2001);
getAssetByNumber(2004);
getAssetByNumber(2007);

public function getAssetByNumber(theNumber : int):XML {
if (!_assets) return null;
var res : XMLList = _assets.*.(number == theNumber);
if (0 != res.length()) {
trace(this, getAssetDetails  + XML(res[0]).childIndex());
return res[0];
} else {
return null;
}
}

-

[object XMLTest] getAssetDetails 0
[object XMLTest] getAssetDetails 1
[object XMLTest] getAssetDetails 2



Am 17.02.2011 13:43, schrieb Glen Pike:

Hi,

The problem is not getting the assets - this works for both example
functions.

The problem is that when I try to trace the childIndex() of the asset
that has been found, it always returns -1 for the asset obtained by
matching the child rather than the attribute.

So the following e4x works, but the childIndex value does not.

var res:XMLList = _assets.(child(number) == String(prop));
if (0 != res.length()) {
debug(this, getAssetDetails  + res[0].childIndex());
return res[0];
} else {
return null;
}

Here is a much shortened list of assets:

entity
id524/id
number2001/number
name![CDATA[Hello]]/name
description![CDATA[Compose Audio]]/description
type1/type
events_count1/events_count

length0.85/length
outputs
/outputs
/entity
entity
id527/id
number2004/number

name![CDATA[Cry]]/name
description![CDATA[Compose Audio]]/description
type1/type
events_count1/events_count
length2.63/length
outputs
/outputs

/entity
entity
id530/id
number2007/number
name![CDATA[Sob]]/name
description![CDATA[Compose Audio]]/description
type1/type

events_count1/events_count
length2.02/length
outputs
/outputs
/entity

On 17/02/2011 12:30, Jens Struwe wrote:

May I refine your question?

I have an XML tree. How can I select nodes depending on the value of
subnodes or the value of subnode attributes.

Hi,


I am having a problem with getting the childIndex value from an e4x
result:

Both these functions work - e.g. they return an XML node from a list,
but the childIndex property always traces as -1 for the first
function.

Can anyone see what the problem is?

TIA

Glen

public function getAssetDetails(prop:*):XML {
if (!_assets) {
return null;
}
var res:XMLList = _assets.(child(number) == String(prop));
if (0 != res.length()) {
debug(this, getAssetDetails  + res[0].childIndex());
return res[0];
} else {
return null;
}
}

override public function getAssetDetails(prop:*):XML {
if (!_assets) {
return null;
}
var res:XMLList = _assets.(attribute(icon) == String(prop));
if (0 != res.length()) {
debug(this, getAssetDetails  + res[0].childIndex());
return res[0];
} else {
return null;
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] checking for properties AS3

2011-02-16 Thread Jens Struwe

Having an example XML could be pretty useful.

And, actually, I don't understand the problem. What should be the 
output? Please hand over all necessary info required to be able to help you.


Am 16.02.2011 12:43, schrieb Geografiek:

Hi list,
I posted this question a week ago on flash tiger, but never got an answer. So I 
try my luck here.

I create an object and dynamically assign properties to it, values from 
xml-nodes.
If an xml-node has child nodes the property assigned is an object and the 
values of the child nodes are assigned as properties to that object:

private function createProperties(node:XML, container:*):void {
 for each (var childNode:XML in node.*) {
 if(childNode.children().length() == 0) {
 container[childNode.localName()] = null;
 } else if(childNode.children().length() == 1) {
 container[childNode.localName()] = childNode.*;
 } else {
 container[childNode.localName()] = new Object();
 createProperties(childNode, container[childNode.localName()]);
 }
 }
}

Now I want to trace what properties are created with the following function:
private function traceProperties(object:Object):void {
 for (var prop:* in object) {
 trace(prop +  is:  + object[prop]);
 traceProperties(prop);
 }
 if(object.hasOwnProperty(layers)) {
 trace(this.layers.gemeenteNaam.title is:  + 
this.layers.gemeenteNaam.title);
 trace(this.classes.class1.keyText is:  + 
this.classes.class1.keyText);
 }
}

This traces:
source is: null
note is: null
subTitle is: null
copyright is: Geografiek, 2011
mapType is: chorochromaat
classes is: [object Object]
key is: [object Object]
layers is: [object Object]
this.layers.gemeenteNaam.title is: gemeentenamen
this.classes.class1.keyText is: Noord-Nederland


From this I gather that all properties are actually created on their desired 
level (last 2 traced lines).

But the function traceProperties() does not automatically catch all properties. 
At least not the properies inside the objects
How do I check if an object has properties at all and how do I trace them?
TIA
Willem van den Goorbergh

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)30-2719512 or cell 
phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: www.geografiek.nl
twitter: @wvdgoorbergh
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=





___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] checking for properties AS3

2011-02-16 Thread Jens Struwe

To recusively dump your complex object you might use:

function traceProperties(object : Object, depth : uint = 0) : void {
for (var prop : String in object) {
trace (prefix(depth), prop, object[prop]);
if (object[prop] is Object) traceProperties(object[prop], depth + 1);
}

function prefix(depth : uint) : String {
var prefix : String = ;
for (var i : uint = 0; i  depth; i++) prefix += ;
return prefix;
}
}

Anyway, there is also an error in createProperties. Look at the attached 
test file to compare with my fixes. Hope the list allows me to pass files.


map [object Object]
classes [object Object]
class2 [object Object]
value RA02
areaColor 0xFF
keyText Noord-Nederland2
class1 [object Object]
value RA01
areaColor 0xEBDBAA
keyText Noord-Nederland
subTitle k
layers [object Object]
gemeenteNaam [object Object]
visible false
title [object Object]
nl gemeentenamen

Best,

Jens

Am 16.02.2011 13:29, schrieb Geografiek:

Hi Jens,
What I basically want is to transform the xml structure into an object 
structure.
xml:
map id=gemRegioIndeling
 subTitle/subTitle
 classes
 class1
 areaColor0xEBDBAA/areaColor
 keyText![CDATA[Noord-Nederland]]/keyText
 valueRA01/value
 /class1
 class2
 areaColor0xEBDBAA/areaColor
 keyText![CDATA[Noord-Nederland]]/keyText
 valueRA01/value
 /class2
 layers
 gemeenteNaam
 visiblefalse/visible
 title
 nl![CDATA[gemeentenamen]]/nl
 /title
 /gemeenteNaam
 /layers
/map

flash object:
map
map.classes
map.classes,class1
map.classes,class1.areaColor
map.classes,class1.value
...
map.classes,class2
map.classes,class2.areaColor
map.classes,class2.value
...
...
...
map.layers
...
...
...

Things seem to work, but I want to traverse the properties tree of the flash 
object and can't get that part working.
Thanks,
Willem van den Goorbergh

On 16 feb 2011, at 13:10, Jens Struwe wrote:


Having an example XML could be pretty useful.

And, actually, I don't understand the problem. What should be the output? 
Please hand over all necessary info required to be able to help you.

Am 16.02.2011 12:43, schrieb Geografiek:

Hi list,
I posted this question a week ago on flash tiger, but never got an answer. So I 
try my luck here.

I create an object and dynamically assign properties to it, values from 
xml-nodes.
If an xml-node has child nodes the property assigned is an object and the 
values of the child nodes are assigned as properties to that object:

private function createProperties(node:XML, container:*):void {
 for each (var childNode:XML in node.*) {
 if(childNode.children().length() == 0) {
 container[childNode.localName()] = null;
 } else if(childNode.children().length() == 1) {
 container[childNode.localName()] = childNode.*;
 } else {
 container[childNode.localName()] = new Object();
 createProperties(childNode, container[childNode.localName()]);
 }
 }
}

Now I want to trace what properties are created with the following function:
private function traceProperties(object:Object):void {
 for (var prop:* in object) {
 trace(prop +  is:  + object[prop]);
 traceProperties(prop);
 }
 if(object.hasOwnProperty(layers)) {
 trace(this.layers.gemeenteNaam.title is:  + 
this.layers.gemeenteNaam.title);
 trace(this.classes.class1.keyText is:  + 
this.classes.class1.keyText);
 }
}

This traces:
source is: null
note is: null
subTitle is: null
copyright is: Geografiek, 2011
mapType is: chorochromaat
classes is: [object Object]
key is: [object Object]
layers is: [object Object]
this.layers.gemeenteNaam.title is: gemeentenamen
this.classes.class1.keyText is: Noord-Nederland


 From this I gather that all properties are actually created on their desired 
level (last 2 traced lines).

But the function traceProperties() does not automatically catch all properties. 
At least not the properies inside the objects
How do I check if an object has properties at all and how do I trace them?
TIA
Willem van den Goorbergh

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)30-2719512 or cell 
phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: www.geografiek.nl
twitter: @wvdgoorbergh

Re: [Flashcoders] Calling an element in an Array as an Class

2011-02-11 Thread Jens Struwe

Version 1:

public class EmbedTest extends Sprite {
[Embed(source=clear.png)]
private static const PRO_CAR : Class;
public static const ALL_CARS:Array = [PRO_CAR];

public static function getAsset( index:uint ) : Bitmap {
return new ALL_CARS[index]();
}

public function EmbedTest() {
addChild(getAsset(0));
}
}

Version 2:

public class EmbedTest2 extends Sprite {
[Embed(source=clear.png)]
private static const PRO_CAR : Class;

public static function getAsset(name : String) : Bitmap {
try {
return new EmbedTest2[name]();
} catch (e:Error) {
trace (ERROR asset is not accessible  + name);
}
return new Bitmap();
}

public function EmbedTest2() {
addChild(getAsset(PRO_CAR));
addChild(getAsset(PRO_CAR2));
}
}

Am 11.02.2011 15:30, schrieb Sidney de Koning - Funky Monkey Studios:

public static function getAsset( index:uint ):Bitmap {

return Bitmap( new ALL_CARS[index]() as Class );
}


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Events for setChildIndex, swapChildren, swapChildrenAt

2011-02-06 Thread Jens Struwe

Does anybody know a way to catch z-index modifications?

I would like to detect if a sprite becomes the first/last child of its 
parent at runtime.


:-?
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Events for setChildIndex, swapChildren, swapChildrenAt

2011-02-06 Thread Jens Struwe

What a quick response! Isn't it sunday in France?

Well, I know of both methods. Unfortunately, I don't define the 
particular container that I wish to track.


...

When I could route all setChildIndex calls globally to a custom method, 
I would be able to identify the affected parent and all depending 
children. @The hackers: How do I hack this? Is there some prototyping to 
such dirty things?



Am 06.02.2011 13:41, schrieb ekameleon:

Sorry... I forget :

or handle the added events with addEventListener( Event.ADDED , .. or
addEventListener( Event.ADDED_TO_STAGE

EKA+ :)

2011/2/6 ekameleonekamel...@gmail.com


Hello :)

Extends the MovieClip or Sprite class and override the methods with custom
event dispatch inside.

EKA+ :)

2011/2/6 Jens Struwej...@struwe.net

Does anybody know a way to catch z-index modifications?


I would like to detect if a sprite becomes the first/last child of its
parent at runtime.

:-?
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Fun with focus, tabbing and IE

2011-02-04 Thread Jens Struwe

Hello,

I was about to create a focus handling for an application when I 
discovered the SWF parameter seamlessTabbing which is true by default 
for Active-X players. The property includes Flash objects in the usual 
browser's tab loop. I don't know, if this is a good thing or not. 
Anyway, I was surprised when I found my application behaving differently 
in IE and Firefox.


Since I could not find any related stuff in the internet (came always to 
fl.* or mx.*), I have coded a small focus testing harness which may also 
help you in the case you are dealing with focus:


http://sibirjak.com/projects/jsdk/focustests/focustest.php

If you are interested in the results of my tests:

http://sibirjak.com/osflash/blog/fun-with-focus-tabbing-and-ie/

Best,

Jens
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] 'trace' executes function

2011-02-02 Thread Jens Struwe
trace() is a normal function. If you pass arguments to trace(), they 
will be evaluated first.


1. trace (name == Jens);
Wouldn't you here expect a true or false depending on your name?

2. Write a custom function to which you pass 
setMovieClipX(movieClip,286). What parameter type you would use?


function testUpdate(updated : Boolean) : void {
trace (updated, updated);
}
testUpdate(setMovieClipX(movieClip,286));

In this case it seems to be clear that the mc is positioned first.

3. I cannot count how many times I have tried to find a bug due to this 
trace(expression) issue. While in DEBUG mode everything worked well, the 
production version did not work :-) It is really a danger that should be 
in mind.


Jens

Am 02.02.2011 11:12, schrieb Wenzler, Thomas:

Hi List, I just made a little experiment with this code...

function setMovieClipX(mc,desiredCoordX):Boolean
{
var updated:Boolean=true;
(desiredCoordX!=mc.x)?mc.x=desiredCoordX:updated=false;
return updated;
}
trace(setMovieClipX(movieClip,286));

...and found to my utmost surprise that the trace command actually executed the 
function and updated the movieClip.x position instead of just tracing true or 
false.
If you check omit Trace in the Publish settings, movieClip remains at it's x 
Position.

Wonder if this could be of any use or is a potential danger when using traces 
to debug?

Regards
Thomas
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders