Re: [Flashcoders] URLStream, POST and requestHeaders

2008-10-20 Thread EECOLOR
I just found out the problem. If you put a value in the 'data' property of
the urlRequest everything starts to work:

*  var r:URLRequest = new URLRequest("http://www.google.com";);
  r.method = URLRequestMethod.POST;
  r.data = 0;

*

Now the request will be sent as post and request headers are sent with it.
Apparently the flash player thinks it is only usefull to check the
URLRequest for additional arguments if the 'data' property is filled.

Greetz Erik

On Mon, Oct 20, 2008 at 1:53 AM, Glen Pike <[EMAIL PROTECTED]>wrote:

> Hi,
>
>   Does your request go out at all?
>
>   Have you used some kind of web-proxy to look at what is going out of your
> Flash across the network - "Charles" http://www.charlesproxy.com/
>
>   Check that the system is not requesting a crossdomain.xml file before
> your request - you may not have problems in the IDE, but maybe in the
> browser / standalone - but FP may not be sending if the x-domain is "not
> working" satisfactorily.
>
>   Glen
>
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] URLStream, POST and requestHeaders

2008-10-19 Thread EECOLOR
Hello,

I am trying to do a request with custom request headers. In the
documentation I found the following line:

"Due to browser limitations, custom HTTP request headers are only supported
for POST requests, not for GET requests."

So I changed my request to post, the request however does not seem to go out
as a post request. The code I use to test is the following:

*  var r:URLRequest = new URLRequest("http://www.google.com";);
  r.method = URLRequestMethod.POST;

  var s:URLStream = new URLStream();
  s.load(r);
*

I have tested this both with Flash player 9,0,124,0 and 10,0,12,36
standalone.*
*

Is this expected behaviour and am I missing something, or should this work
just fine?

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


Re: [Flashcoders] addChild multiple instances of a loader

2008-09-24 Thread EECOLOR
If img.jpg is on the same server as your swf, you wont have a problem.
Otherwise you would need a crossdomain.xml.

>From the top of my head you could do something like this:

function onLoadComplete(e:Event):void
{
   var bitmap:Bitmap = Bitmap(_loader.content);

   var clone1:Bitmap = new Bitmap(bitmap.bitmapData);
   target1.addChild(clone1);

   var clone2:Bitmap = new Bitmap(bitmap.bitmapData);
   target2.addChild(clone2);
}

I am not sure if 2 Bitmap instances allow you to use the same bitmap
data. If that is not the case you could just copy the bitmap data.
This would however use more memory, so I would try the above thing
first.


Greetz Erik



On 9/17/08, Fabio Pinatti <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> I'm preloading some swf's and images, and I want use some same loaded
> instances for some movieclips. For example, I load a file img.jpg. and
> on complete of it, I want add the loaded bitmap to 10 movieclips. When
> I addChild, all movieclips are overrided and just the last one has the
> loaded content. With images I can use bitmap data for copying data,
> but and if I load swfs or whatever?
>
> I've googled but didn't find any clear, at least for me. Can you help
> me pls, gurus?
> ,
> Thanks so much
>
> --
> Fábio Pinatti
> :: web.developer
>  www.pinatti.com.br
> :: 19. 9184.3745 / 3342.1130

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


Re: [Flashcoders] parsing newlines in textdocuments

2008-09-24 Thread EECOLOR
I think I would go for this:

Replace the \r\n with \n and then split on \n.


Greetz Erik


On 9/8/08, Martin Klasson <[EMAIL PROTECTED]> wrote:
> Hi Coders,
>
> I am gonna to make a parser for the MicroDVD subtitle format,
> but I am not being able to find the documentation, yet a simple example for
> how it looks.
>
> but the problem I know I will have is how to parse a text-file that are
> having linebreaks,
> since they appearantly are different if the textfile has been on a
> mac/unix/windows
>
> I hope anyone here can point out for me how to deal with this.
>
> Why I am using the MicroDVD is that the time-codes is being in frames and
> not seconds,
> which will make it easier for the one producing the swf's which will be
> loaded as our "movies",
> to be able to synch that together with the animations and so on.
>
> but any input is welcome of course!
>
>
> --
>
> Martin Klasson
> Flash Developer
> Parkgatan 9-11
> S-411 24 Göteborg
> Sweden
> Office +46 (0) 31 711 54 50
> Cell +46 (0) 730 964 561
> [EMAIL PROTECTED]
> www.kokokaka.com
> ___
> 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] A Question that I've been asking for years!!

2008-09-02 Thread EECOLOR
There is one usecase that most Flash developers will come across. Lets say
we have a loader.swf in which the main (or base) class is Loader.as.
Loader.as loads main.swf, main.swf has as main (or base) class Main.as.
Loader.as needs to give a signal to the loaded main.swf and tries to type
the instance on the stage as Main. This way, Loader.as will makes sure the
file that is loaded is who he expects it to be (namely Main.as).
The above situation poses a problem. If Loader.as references Main.as,
Main.as will be compiled into loader.swf as well. In most cases this will
result in a loader.swf that is of the same size as main.swf. In order to fix
this we need to make use of an interface.
The Main.as will implement the interface and Loader.as will type Main.as not
as Main, but as the interface. This way only the interface will be compiled
into the loader and not the implementation (or Main.as). While this solves
the problem described earlier it also gives some extra benefits. The loader
is suddenly reusable. It no longer depends on a specific implementation of
any class. It will accept all classes that implement the interface.
I hope this usecase adds anything to the discussion.
Greetz Erik
On Tue, Aug 26, 2008 at 4:32 AM, ben gomez farrell <[EMAIL PROTECTED]>wrote:

> Yah, maybe the word isn't "contract" but a "contract with loopholes".
>  Anyway, it does a good job of getting intention across, regardless, across
> a broad set of code.  But yah, i can see the value in it, and I can see that
> its a little extra effort that might not be worth it.  I'm still more in the
> stage where I try to apply it to things to see if it's useful.  I'm not sure
> if it's helped so far, but it hasn't hurt.
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AMF objects storing in database

2008-09-02 Thread EECOLOR
In the example they expect you to implement IExternalizable. This is only
needed if you want to preserve properties that do not have both a getter and
a setter. In most cases a public var is enough, then you wont have to
implement the IExternalizable.

"I wanted to know, can I then just send the AMF object to a server and store
it as a binary in a mysql database? And also is this adviceable?"

I have used this approach to store typed and complex data that is only used
in Flash. I love it :)

Greetz Erik


On Thu, Aug 28, 2008 at 7:00 PM, Jiri Heitlager <
[EMAIL PROTECTED]> wrote:

> I came across a post on storing custom classes as an AMF object. It
> explains how to do the following.
>
> "If you ever need to store the state of a custom object in a ByteArray or
> SharedObject, or send a custom object through a LocalConnection, there are a
> few simple steps you can take that will allow your object's state to be
> serialised (converted to AMF) and preserved for future restoration.
> "
> src: http://www.si-robertson.com/go/serialise-custom-classes
>
>
> I wanted to know, can I then just send the AMF object to a server and store
> it as a binary in a mysql database? And also is this adviceable?
>
> Thank you,
>
> Jiri
>
> ___
> 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] MouseEvents on overlapping siblings in AS3

2008-09-02 Thread EECOLOR
Just a guess, but you could change the listener to MOUSE_OVER instead of
ROLL_OVER. The difference between the two is very subtle and explained at
the reference documentation of InteractiveObject. I am not sure if it is
applicable to the problem posed.

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


Re: [Flashcoders] delegate.create query

2008-06-14 Thread EECOLOR
The this within the xmlOnload now points to the object you gave as scope to
the create method of delegate.

In order to access the xml object you would need to reference xmlDoc
instead.

The whole point of Delegate is to make sure mehods are called with the
correct scope. xmlOnLoad will be called with the scope it's defined on as
you call Delegate.create(this, xmlOnload).

I hope this explains it.


Greetz Erik


On 6/13/08, allandt bik-elliott <[EMAIL PROTECTED]> wrote:
>
> the delegate questions have kinda hijacked the other question i've asked so
> i'd like to have a separate discussion here if i can
>
> i've got a method that broadcasts a message to the instancing class but if
> i
> delegate it, it doesn't seem to work
>
> here is my original method with the anonymous function that works
> correctly:
>
> private function getXML():Void
> {
> var ref = this;
> xmlDoc.ignoreWhite = true;
> xmlDoc.onLoad = function():Void
> {
> ref.broadcastMessage("ready");
> }
> xmlDoc.load(sPath);
> }
>
>
> here is what i've tried to do to use the Delegate class instead:
>
> private function getXML():Void
> {
> xmlDoc.ignoreWhite = true;
> xmlDoc.onLoad = Delegate.create(this, xmlOnLoad);
> xmlDoc.load(sPath);
> }
>
> private function xmlOnLoad():Void
> {
> trace(this); traces[object, Object] if next line is commented out
> this.broadcastMessage("ready");
> }
>
> i'd love to use this more but it seems there are a lot of hoops to jump
> through at the moment
>
> a
> ___
> 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] AS3 - A simple questions

2008-06-05 Thread EECOLOR
I would recommend using event.currentTarget instead of event.target at all
times.

the event.currentTarget property contains a reference to the instance at
which you registered the event listener. event.target refers to the class
that dispatches the event.

In this case there is no difference between .target and .currentTarget, but
in future cases you might encounter problems. The cases where you would use
event.target are so rare that I would urge everyone to allways use
event.currentTarget.


Greetz Erik


On 6/3/08, Rich Shupe <[EMAIL PROTECTED]> wrote:
>
> for (var i:int = 0; i < 3; i++) {
> var txtFld:TextField = new TextField();
> txtFld.name = "TextField" + i;
> txtFld.border = true;
> txtFld.x = i*120;
> addChild(txtFld);
> txtFld.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
> }
>
> function onClick(evt:Event):void {
> trace("Hi I'm", evt.target.name);
> }
>
>
>
> Rich
> http://www.LearningActionScript3.com
>
>
>
> ___
> 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] API Interface in SWC...

2008-05-29 Thread EECOLOR
API's tend to be exposed through Interfaces. This allows you to program
agains an interface, keeping the implementation (concrete class) out of
sight.

You wrote:

*sumTwoNumbers(numA, numB)
{
   baseApp.sumTwoNumbers(numA,numB)
}*

You should make sure that baseApp is typed as an interface (for example
IBaseApp). Make sure that the BaseApp class implements IBaseApp. The
IBaseApp would look like this:

*public interface IBaseApp
{
   function sumTwoNumbers(numA:Number, numB:Number):Number;
}*

I hope this helps you.


Greetz Erik


On 5/27/08, Helmut Granda <[EMAIL PROTECTED]> wrote:
>
> I am creating a SWC file that will be given to the client with the basic
> API
> that they can use to reference to the main application.
>
> It all makes sense in my mind and in writing (create the methods that
> delegate to the main application).
>
> I have a basic format working but in order for it to work I have to include
> the classes that will handle all the process and that is what I am trying
> to
> avoid since we want full control of the base methods used within the
> application.
>
> For example:
>
> API:
> sumTwoNumbers(numA, numB) {
> baseApp.sumTwoNumbers(numA,numB)
> }
>
> but in order for this to work i need to import baseApp class or else i will
> get compile errors. My second option would be to dispatch events when
> necessary:
>
> sumTwoNumbers(numA, numB){
> dispatchEvent(new CustomEvent ( CustomEvent.sumTwoNumbers, numA, numB))
> }
>
> But i am not sure if this is the appropriate approach. Could some one that
> has dealt with similar situations share some wisdom here?
>
> TIA
> ___
> 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] as3 - calling / sending with vars

2008-05-27 Thread EECOLOR
Another way to make the URLRequest is like this:

*var urlVariables:URLVariables = new URLVariables("var1=1&var2=10");

var request:URLRequest = new URLRequest("http://url.com/";);
request.data = urlVariables;*


Greetz Erik


On 5/27/08, Søren Christensen <[EMAIL PROTECTED]> wrote:
>
> Hi Viktor
>
> This was what I was looking for, thanks :-)
>
>
> Cheers,
> >B) Søren
>
> On May 27, 2008, at 4:20 PM, Viktor Hesselbom wrote:
>
> var request:URLRequest = new URLRequest( "http://url.com/?var1=1&var2=10";
>> );
>> sendToURL(request);
>>
>
> ___
> 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] Tweening text more smoothly - AS3

2008-05-25 Thread EECOLOR
>But in the end, how do you know that under the
>hood, the flash player is not doing exactly the same operation for an int
>cast, a Math.floor call and a shift zero ?

Well, the thing here is that Math.floor is a function call. Function calls
are by default more complex than using operators. This would explain why
Math.floor is heavier than any other way of doing it.


Greetz Erik


On 5/25/08, Juan Pablo Califano <[EMAIL PROTECTED]> wrote:
>
> >
> > I use modulo for rowing too and int() instead of Math.floor() as it's
> > faster. ;)
>
>
>
> Laurent,
>
> is it, really?
>
> I'm not sure. I recently made similar assumptions about what's faster an
> what's slower based on what "made sense", only to be proved wrong by some
> actual benchmarking.
>
> Anyway, if the variable is typed as an int, my understanding is that you
> don't need to use Math.floor or a cast to int, since the decimal part will
> be truncated automatically.
>
> Another option to discard decimals is to use bit shifting ( i >> 0), which
> some people say it's faster. But in the end, how do you know that under the
> hood, the flash player is not doing exactly the same operation for an int
> cast, a Math.floor call and a shift zero ?
>
> Cheers
> Juan Pablo Califano
>
>
> 2008/5/25, laurent <[EMAIL PROTECTED]>:
>
> >
> > Thanks Jesse for the neat explanation, it all make sense, that's a clever
> > trick to get a smooth movement of this type where tweening is not a
> > solution.
> > That can be applied to other things just to get the right value to
> change.
> > Very good to know that enter Frame and Timer are approximations.
> > I use modulo for rowing too and int() instead of Math.floor() as it's
> > faster. ;)
> >
> > L
> >
> > Jesse Graupmann a écrit :
> >
> >> @Laurent
> >>
> >> So modulus is great and slow from what I've read. I tend to use it in
> row/
> >> column calculation rather than wrapping a MovieClip position.
> >>
> >> var num:int = 6;
> >> var cols:int = 3;
> >>
> >> for ( var i:int = 0; i < num; i++ ) {
> >>var row:int = Math.floor( i / cols );
> >>var col:int = i % cols;
> >>
> >>trace ( "i: " + i + "\trow:" + row + "\tcol:" + col );
> >> }
> >>
> >> i: 0row:0   col:0
> >> i: 1row:0   col:1
> >> i: 2row:0   col:2
> >> i: 3row:1   col:0
> >> i: 4row:1   col:1
> >> i: 5row:1   col:2
> >>
> >>
> >> In the previous post I'm moving a MovieClip to the right X.X pixels and
> >> when
> >> its position is off the screen I reset it back to 0. If I used the
> modulus
> >> method, the movement would always be rounded numbers and appear jerkier
> >> than
> >> this experiment requires. I'm actually hoping to round to the nearest
> >> twip.
> >>
> >>
> >> As for the examples themselves
> >>
> >>
> >> #1
> >> onT is a timer tick. So about every 30ms it will move the MovieClip X
> >> pixels
> >> based on speed. Because Timers are never accurate to what you expect (
> >> they
> >> only get as close as they can - see below ) onT will always be dragging
> >> behind the other two methods and moving at varied speeds.
> >>
> >> //  Elapsed time from a tick on var t:Timer = new Timer(30);
> >>
> >>
> >>
> 47,38,36,36,36,36,36,38,36,35,35,36,36,34,36,42,36,35,35,36,35,37,40,36,36,3
> >>
> >>
> 6,36,36,54,36,37,35,34,36,38,38,36,36,36,36,69,39,35,36,35,36,36,42,44,36,36
> >>
> >>
> ,35,36,35,63,37,33,36,35,37,40,30,35,34,36,92,55,66,35,36,34,36,46,36,36,36,
> >>
> >>
> 36,97,50,34,35,35,36,36,34,33,218,142,49,121,59,110,84,102,65,106,66,58,55,6
> >>
> >>
> 5,34,36,35,36,64,33,35,36,35,37,31,48,34,36,35,35,36,77,34,34,36,36,36,70,36
> >>
> >>
> ,35,37,35,37,74,54,35,36,71,65,35,36,36,35,35,73,37,36,36,34,43,66,35,38,36,
> >>
> >>
> 35,34,73,36,34,50,59,67,37,36,36,36,56,47,37,36,36,34,36,30,46,35,36,36,36,5
> >>
> >>
> 9,46,35,36,36,36,59,45,35,36,36,34,36,32,48,37,37,35,38,56,48,34,36,36,36,58
> >>
> >>
> ,47,34,37,36,36,57,72,45,36,50,55,45,35,35,35,36,61,45,36,35,35,36,66,45,131
> >> ,39,45,33,37,34,37,34,45,51,36,51,49,38,67,35,36,36,34,43,47,38,50,35,34
> >>
> >> //  Difference from expected 30ms
> >>
> >>
> >>
> 17,8,6,6,6,6,6,8,6,5,5,6,6,4,6,12,6,5,5,6,5,7,10,6,6,6,6,6,24,6,7,5,4,6,8,8,
> >>
> >>
> 6,6,6,6,39,9,5,6,5,6,6,12,14,6,6,5,6,5,33,7,3,6,5,7,10,0,5,4,6,62,25,36,5,6,
> >>
> >>
> 4,6,16,6,6,6,6,67,20,4,5,5,6,6,4,3,188,112,19,91,29,80,54,72,35,76,36,28,25,
> >>
> >>
> 35,4,6,5,6,34,3,5,6,5,7,1,18,4,6,5,5,6,47,4,4,6,6,6,40,6,5,7,5,7,44,24,5,6,4
> >>
> >>
> 1,35,5,6,6,5,5,43,7,6,6,4,13,36,5,8,6,5,4,43,6,4,20,29,37,7,6,6,6,26,17,7,6,
> >>
> >>
> 6,4,6,0,16,5,6,6,6,29,16,5,6,6,6,29,15,5,6,6,4,6,2,18,7,7,5,8,26,18,4,6,6,6,
> >>
> >>
> 28,17,4,7,6,6,27,42,15,6,20,25,15,5,5,5,6,31,15,6,5,5,6,36,15,101,9,15,3,7,4
> >> ,7,4,15,21,6,21,19,8,37,5,6,6,4,13,17,8,20,5,4
> >>
> >>
> >> #2
> >> onT2 - To compensate for the difference, I decide that for every 30ms
> that
> >> have passed the MovieClip should increment the correct amount ( 1 pixel
> ).
> >> When the tick occurs, I subtract the stored 

Re: [Flashcoders] Tweening text more smoothly - AS3

2008-05-23 Thread EECOLOR
You could create a bitmap using BitmapData.draw. Add that to your display
list, set cacheAsBitmap to true and things should run smootly.

Not sure if it works, but it is just another suggestion.


Greetz Erik

On 5/22/08, Vayu Robins <[EMAIL PROTECTED]> wrote:
>
> Hej.
>
> I am wondering if there is anything that could be done to improve the
> panning/scrolling/tweening of the news items at the bottom of the this
> page:
>
> http://flashkompagniet.dk/flash/main.php
>
> I am running a timer at 20 milliseconds Timer(20, 0);
>
> And the news items are being moved a 1px everytime the timer event is
> dispatched.
>
> I dont think they are runnning very smoothly.  Is that just me or does
> anyone else see that too.
>
> Can anything be done?
>
> Thanks
> Vayu
>
>
> ___
> 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] stack overflow in IE ?

2008-05-20 Thread EECOLOR
Are you using LocalConnection by any chance?


Greetz Erik


On 5/20/08, Andrei Thomaz <[EMAIL PROTECTED]> wrote:
>
> dear Jonathan,
>
> in my computer, with the same versions of Firefox and FP, also under Vista,
> it runs fine.
> What worries me is that it doesn't use recursion, just some nested loops,
> used when the algorithm ends.
>
> thank you,
> andrei
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Play MOV in flash

2008-05-19 Thread EECOLOR
If I recall correctly, you can only play .mov files if they are encoded with
the H.264 codec. And only if you have Flash player 9.0.124.


Greetz Erik

On 5/17/08, Scott Wilhelm (HireAWebGeek.com) <[EMAIL PROTECTED]> wrote:
>
> Is it possible to play a MOV file within flash?
>
>
>
> Thanks,
>
>
>
> Scott
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Giving all objects new methods ...

2008-05-17 Thread EECOLOR
I created a file called dump.as within the fly.utils package:

*package fly.utils
{
   public function dump(obj:Object, maxSuperClasses_int:int = 0):void
   {
   };
};*

This way, I can just call* dump("something")*.


Greetz Erik


On 5/17/08, Stephen Ford <[EMAIL PROTECTED]> wrote:
>
> AS3 Question:
>
> Is there a way to give all classes in every package a couple of new
> methods?
>
> I want to create a couple of new custom trace methods and have them
> available for every class within the type heirachy.
>
> Currently, I've extended the Sprite type to include these trace methods and
> most of my classes then extend this new Sprite type (which I've called
> SpriteX). Therefore the new functions are accessed as such:
>
> tracer("trace my string biatch", 0);
>
> However, I've also extended the Event class with a new Event type, but can
> only access these new trace methods via a direct reference to the public
> static functions within the new Sprite type. i.e:
>
> SpriteX.tracer("trace my string biatch", 0);
>
> I want all types to be able to call the method directly as an internal
> function.
>
> So I could possibly hack the native flash Object type, is this the best way
> to do this?
>
> Cheers,
> Stephen.
> ___
> 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] Why do you compile with the Flash IDE?

2008-05-16 Thread EECOLOR
I hardly ever use the Flash IDE these days. I program with FlexBuilder and
import images created by the designers. I am wondering, why are some of you
still using the Flash IDE to compile your applications?

What is the big benefit of using the Flash IDE in combination with
ActionScript?


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


Re: [Flashcoders] Re: Retrieve The Web Link

2008-05-15 Thread EECOLOR
When we need the URL of the page that is serving the swf, we use
ExternalInterface to call the window.location.href.toString() method.


Greetz Erik

On 5/8/08, Juan Pablo Califano <[EMAIL PROTECTED]> wrote:
>
> Yes, but be aware that the _url property returns the url of the swf, not
> the
> url of the HTML that embeds it. You can strip the file name and get just
> the
> directory path, if that's what you're looking for, but that'd work only if
> your html and your swf are in the same folder.
>
> Cheers
> Juan Pablo Califano
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Data merging problem

2008-05-15 Thread EECOLOR
I am not sure why you have duplicate items. I am assuming these items come
from a database, you can use the query to leave out double records. In most
other cases, the double is in there for a reason, which means you do not
want to delete them. In that case you would like the .filterFunction
property. The filterFunction property is used to make sure an item is not
displayed while it is in the collection, this is used as follows:

*arrayCollection.filterFunction = removeDuplicate;

function removeDuplicate(item:Object):Boolean
{
   /*
  Do you magic here. More then one option exists. You could create
fingerprint of your object here and
  store it in an object as a key, like this:

  var ba:ByteArray = new ByteArray();
  ba.writeObject(item);

  var fingerprint:String = ba.toString();

  if (checkObject.hasOwnProperty(fingerprint))
  {
 keepItem = false;
  } else
  {
 checkObject[fingerprint] = true;
 keepItem = true;
  };

  The above method only works if you data does not contain an ID.
Another option (which might be faster
  in most cases, testing required) is to loop over the collection and
check if the items that contain the same
  data are infact the same objects. In this case I would not use a for
loop, but a while(i--) loop since these
  tend to be a bit faster and order does not matter in this case.
   */
};*

In order to apply the filter use the .refresh method of the array
collection.


Greetz Erik


On 5/9/08, Juan Pablo Califano <[EMAIL PROTECTED]> wrote:
>
> If you're going to remove elements with a splice, you should loop backwards
> (for var i:Number = array.length - 1;i >= 0; i++), because when you loop
> forward and take out one element, the relative position of the next items
> will change.
>
> Cheers
> Juan Pablo Califano
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 - Embeding Fonts

2008-05-15 Thread EECOLOR
I am not sure what you are talking about, but using Flex Builder 3 and an
ActionScript project, this code works fine:

*package
{
 import flash.display.Sprite;
 import flash.text.TextField;
 import flash.text.TextFieldAutoSize;
 import flash.text.TextFormat;
 import fly.easing.Tween;
* *
 public class EmbedFontTest extends Sprite
 {
  [Embed(source="C:\\WINDOWS\\Fonts\\ARIAL.TTF", fontFamily="Arial")]
**  **private var _arial_str:String;
**  **private var _arial_fmt:TextFormat;
**  **private var _text_txt:TextField;
**
**  **public function EmbedFontTest()
**  **{
**  **  **super();
**  **  **this.initEmbedFontTest();
**  **}
**
**  **private function initEmbedFontTest():void
**  **{
**  **  **this._arial_fmt = new TextFormat();
**  **  **this._arial_fmt.font = "Arial";
**  **  **this._arial_fmt.size = 40;
**
**  **  **this._text_txt = new TextField();
**  **  **this._text_txt.embedFonts = true;
**  **  **this._text_txt.autoSize = TextFieldAutoSize.LEFT;
**  **  **this._text_txt.defaultTextFormat = this._arial_fmt;
**  **  **this._text_txt.text = "Test Arial Format";
**
**  **  **this.addChild(this._text_txt);
**  **}
 }
}*

Ahh, I re-read the the last question, hehe:

>is the only way to embed the font in the IDE??

Yes, you can not use AS3 to embed fonts if you are compiling using Flash
CS3. I am not sure what the problem is though. If you are compiling with
Flash CS3 anyway you have a way to embed them. If you insist on embedding
fonts using ActionsScript, you might consider downloading the Flex 3 SDK or
Flex Builder 3. The Flex SDK contains a compiler that can compile
ActionScript projects. You could use this compiler to compile your fonts
into separate swf and load those in.

>Flash doesn't understand any meta tags.

This is correct, Flash CS3 does not understand the metadata tags.

The ActionScript compiler from the Flex SDK does understand them, but not
all of them are usefull, most important, the [RemoteClass] and [Bindable]
tags can not be used in an ActionScript project.

The Flex compiler does understand them and also uses all of the Adobe
provided ones.


Greetz Erik





















On 5/15/08, SJM <[EMAIL PROTECTED]> wrote:
>
> Ive read a load of sites that reference that way of doing it, however id
> does not seam to work in AS3. Further down the page the guy who writes the
> blog it is says this...
>
> Tink Says:
> January 2nd, 2007 at 1:39 am
> Flash doesn't understand any meta tags.
> There is no need to use this method in Flash as you can embed the
> font in the IDE.
> Granted it would be nice if Flash did understand the embed tag
> though.
>
> Gianluca Says:
> January 6th, 2007 at 11:21 pm
> So how to embed font in Flash as3?
>
> Tink Says:
> January 7th, 2007 at 4:52 pm
> Same as AS 2.0.
> Either have the font in your library or create a TextField on the
> stage and embed the characters you want.
>
> Is this correct? is the only way to embed the font in the IDE??
>
>
> SJM
>
>   - Original Message -
>   From: EECOLOR
>   To: Flash Coders List
>   Sent: Thursday, May 15, 2008 8:19 PM
>   Subject: Re: [Flashcoders] AS3 - Embeding Fonts
>
>
>   Second link on google: http://www.tink.ws/blog/embedding-fonts-in-as3/
>
>
>   Greetz Erik
>
>
>   On 5/15/08, SJM - Flash <[EMAIL PROTECTED]> wrote:
>   >
>   > Hi Guys
>   >
>   > i know about embeding fonts using the 'embed' button in the textfields
>   > property inspector within in the ide. Can anyone point me to some
> definitive
>   > solutions for embeding fonts into flash using actionscript (v3),!
>   >
>   > Thanks
>   >
>   > SJM
>
>   ___
>   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] alpha not working on mc with textfield

2008-05-15 Thread EECOLOR
Make sure you have the TextField also set to the same size as the font you
embedded in the library. Also check if you maybe embedded the bold or italic
property, your TextField should mirror the settings of the font you used.


Greetz Erik

On 5/13/08, Allandt Bik-Elliott (Receptacle) <[EMAIL PROTECTED]>
wrote:
>
> thanks for the response
>
> i'm using the version with the asterisk after the name
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 - Embeding Fonts

2008-05-15 Thread EECOLOR
Second link on google: http://www.tink.ws/blog/embedding-fonts-in-as3/


Greetz Erik


On 5/15/08, SJM - Flash <[EMAIL PROTECTED]> wrote:
>
> Hi Guys
>
> i know about embeding fonts using the 'embed' button in the textfields
> property inspector within in the ide. Can anyone point me to some definitive
> solutions for embeding fonts into flash using actionscript (v3),!
>
> Thanks
>
> SJM
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] The issue of "parent" in AS3

2008-05-15 Thread EECOLOR
I must disagree with this. Typing to Object will give you extra problems.
You will not get code hinting and are more likely to make typeo's. It also
is much more vulnerable to runtime errors.

As for the original message, I would encourage you not to call any
non-DisplayObject methods in the parent. This will tightly couple
the child to a specific parent, making it useless on other parents.

If you want to pass information to another object you can use the event
system and dispatch an event. Another options is to give the child a
property which is typed to an interface. This property should (in your case)
be set to reference the parent and will give you the ability to call that
specific method. On top of that, the child can be used with another
implementation of the logic you are trying to call.


Greetz Erik

On 5/15/08, Sy Iridium <[EMAIL PROTECTED]> wrote:
>
> Hi,
> don't know if my way is "cleaner" but it is certainly more general because
> if you change the parent class you don't need to "find and replace" all
> type-casting of the previous class with new class. My solution to this is
> to
> type-cast the parent class to Object class. It is dynamic class so you can
> use any methods you have added to your class without restrictions. Hope it
> helps.
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Aligning images and text in textfield / textarea

2008-05-14 Thread EECOLOR
I remember the component named Deng, which is able to render a subset of
HTML. It can be found here:

http://deng.com.br/

HTML within Flash is one of the toughest things to do as the support for
HTML within Flash is very limited.


Greetz Erik

On 5/6/08, Neil Jenkins <[EMAIL PROTECTED]> wrote:
>
> I'm using textareas and textfields to display HTML with text, images and
> CSS and running into problems trying to stop text wrapping around the side
> of images (AS2, Flash8).
>
> Even if the image is as wide as the textarea, any text following the image
> will appear letter by letter vertically down the side of the image until it
> gets to a clear line under the image whereupon it begins to display
> correctly again.
>
> I've cludged it to stop happening by adding multiple  after
> each image depending on the height of each image (lineheight of the text I'm
> using is 18 pixels, so divide the image height by 18 and add that many
> paragraph/break tag combinations as above).
>
> It's a rather messy cludge and requires a stack of extra PHP on the server
> side to parse the HTML and add the extra tags after each image - has anyone
> seen or know about a better way to do this - I'm imagining some one may have
> been able to extend the textarea or textfield class or possibly created a
> more reliable component to display HTML text and images (with vertical
> scrollbar if needed)
>
> many thanks
> Neil
>
> ___
> 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] centering content on stage / resizable stage

2008-05-13 Thread EECOLOR
Make sure you have in your code (somewhere at the start) the following code:

*stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;*

Also make sure that you have the following property in your object / embed
tag:

salign="TL"


Greetz Erik

On 5/14/08, Patrick J. Jankun <[EMAIL PROTECTED]> wrote:
>
> Hello again!
>
> Im quite desparate after trying to find a simply and yet efficient way to
> get my content always in the middle of that stage,
> i wrote simple script, that seems to be working when i launch the stand
> alone player, however when i launch it with the html
> wrapper and in browser, the positions are different (?!?) and i cant
> figure out why, this is probably very stupid, but before
> i just wanted to know how you ppl solve the centering / positioning
> problems in flash/stage
>
> my awesome script:
>
> private function positionContainer() : void {
>_lastBgX = _bg.x;
>_lastBgY = _bg.y;
>var halfW : Number = this.width / 2;
>var halfH : Number = this.height / 2;
>_bg.x = 0;
>_bg.y = 0;
>_bg.width = stage.stageWidth;
>_bg.height = stage.stageHeight;
>_holder.x = (stage.stageWidth / 2) - (_holder.width / 2);
>_holder.y = (stage.stageHeight / 2) - (_holder.height / 2);
> }
>
> _bg is scale, as it's a simple sprite filled with bitmapdata, just for
> testing, and it does what it's suppose to do,
> _holder is my content holder wher i put all my instances, movieclips and
> so on something i dont get is,
> if i have a class that generates something bigger then that _holder
> [width/height] the things starts too look strange
>
> I think i dont really get how that html wrapper works and what are the
> best settings for an fullscreen flash in html
> should i pass settings to the stage class? if yes then which makes sense?
> How do you ppl solve that issue?
>
> Thanks for your Help!
> P.
> --
> fancy skills to pay the bills
> www.jankun.org
>
> Phone:  +43 660 96 969 - 01
> web:jankun.org
> mail:   p[at]jankun.org
>
> ___
> 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] Kilobyte Size of AS Classes

2008-05-13 Thread EECOLOR
If you are using Flex Builder to compile your ActionScript project, you can
use the following compiler arguments:

*-link-report c:\pathToTempDirectory\link-report.xml*

This file will list each class like this:

*
  
  
  
  
*

As you can see it contains the size both compressed and uncompressed.


Greetz Erik

On 5/6/08, Ketan Anjaria <[EMAIL PROTECTED]> wrote:
>
> When I use the Generate Size report in the publish settings, at the end of
> the file it says something like
> ActionScript BytesLocation
> --
> 140568ActionScript 3.0 Classes
>
> Is there a way to break this up by class?
> I would love to get a list of each class and how large it is.
>
> Thanks!
> ___
> 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] as3 namespace question

2008-05-13 Thread EECOLOR
And now the attachment, hehe.


Greetz Erik

On 5/13/08, EECOLOR <[EMAIL PROTECTED]> wrote:
>
> >I posted about this before and didn't receive and answer but it is still
> causing
> >me issues so I am trying again.
>
> There were some concrete answers posted to your question. Anyway, let's
> see if we can solve it again.
>
> Before I will try and help with your problem, I want to point out
> something about your code. I am not sure if you are using (in your real
> application) an interface which you will cast your class to:
>
> *var _lm:ILoadMe = ILoadMe(_ldr.content);*
>
> If you are using the actual class, the problem is that the whole class and
> it's dependencies are compiled into you main swf, defeating a big part of
> the purpose of loading the swf into it.
>
> In my previous reply to your earlier email I posted a Flex version of the
> answer. This time I created a Flash example. It is added as attachment.
>
> The attached zip file contains 2 directories. Make sure you have your
> webserver point to to these directories, the virtual hosts in apache:
>
> *
>   ServerName domain1
>   DocumentRoot "E:\Projects\domain1"
> 
>
> 
>   ServerName domain2
>   DocumentRoot "E:\Projects\domain2"
> *
>
> In the hosts file (if you are on windows) you need these 2 entries:
>
> *127.0.0.1 domain1
> 127.0.0.1 domain2*
>
> In order to test the example, call this url: *http://domain1/domain1.html*
>
> You should see this appear on your screen:
>
> *domain1.swf
> domain2.swf loaded
> Domain2Base*
>
> I hope this will solve your problem.
>
>
> Greetz Erik
>
>
>
>
>
>
>
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] as3 namespace question

2008-05-13 Thread EECOLOR
>I posted about this before and didn't receive and answer but it is still
causing
>me issues so I am trying again.

There were some concrete answers posted to your question. Anyway, let's see
if we can solve it again.

Before I will try and help with your problem, I want to point out something
about your code. I am not sure if you are using (in your real application)
an interface which you will cast your class to:

*var _lm:ILoadMe = ILoadMe(_ldr.content);*

If you are using the actual class, the problem is that the whole class and
it's dependencies are compiled into you main swf, defeating a big part of
the purpose of loading the swf into it.

In my previous reply to your earlier email I posted a Flex version of the
answer. This time I created a Flash example. It is added as attachment.

The attached zip file contains 2 directories. Make sure you have your
webserver point to to these directories, the virtual hosts in apache:

*
  ServerName domain1
  DocumentRoot "E:\Projects\domain1"



  ServerName domain2
  DocumentRoot "E:\Projects\domain2"
*

In the hosts file (if you are on windows) you need these 2 entries:

*127.0.0.1 domain1
127.0.0.1 domain2*

In order to test the example, call this url: *http://domain1/domain1.html*

You should see this appear on your screen:

*domain1.swf
domain2.swf loaded
Domain2Base*

I hope this will solve your problem.


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


Re: [Flashcoders] Converting a ByteArray to string and back again...

2008-04-28 Thread EECOLOR
To me that seems to work perfectly:

var a:Array = new Array();
a.push("hello");
a.push("this");
a.push("is");
a.push("a");
a.push("test");

var ba:ByteArray = new ByteArray();
ba.writeObject(a);
ba.position = 0;

var ba2:ByteArray = new ByteArray();
ba2.writeUTFBytes(ba.toString());
ba2.position = 0;

trace(ba2.readObject() is Array);
ba2.position = 0;
trace(ba2.readObject());

Instead of ba.toString you could also use ba.readUTFBytes.


Greetz Erik


On 4/26/08, Ian Thomas <[EMAIL PROTECTED]> wrote:
>
> Hi John,
>I'm surprised writeUTFBytes doesn't work - in what way doesn't it work?
>
>
> Ian
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to compare 2 dynamic Arrays

2008-04-28 Thread EECOLOR
I think you could use a ByteArray to do it. It would be (from the top of my
head) something like this:

sBA = new ByteArray();
sBA.writeObject(sArray);

var t1BA:ByteArray = new ByteArray();
t1BA.writeObject(t1Array);

trace(sBa.toString() == t1BA.toString());


Greetz Erik


On 4/28/08, ACE Flash <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I have 2 dynamic Arrays, t1Array and  t2Array, both of them need
> compare with sArray(standard array).
>
> I have to call Line 26 for each t2Array[n] => onCompare(sArray,
> t2Array[0]);
>
> is there any simply way  to achieve this? so it could be looping for
> comparing all dynamic arrays?
>
>
> http://www.privatepaste.com/901OpAMhtn
>
> Thank You
> ___
> 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] Is Adobe fixing this big FP9 problem?

2008-04-28 Thread EECOLOR
If I recall correctly, the problem only exists with event listeners for
Timer, stage and EnterFrame event listeners.

Stage listeners are easy to clean up. If you ever attach a listener to the
stage, add it within the ADDED_TO_STAGE handler, make sure you remove it
within the REMOTED_FROM_STAGE handler. I am not sure, but I think using a
weak listener here would do the trick as well and would prevent you from
needing to remove it.

As for Timer and EnterFrame events, make sure you never run them forever. In
all cases I can think of, there is no need to let them run forever. Running
them forever is just lazy programming. If you have a usecase where one of
these would run forever I am interested in it :)

As for normal events, this has (as far as I can tell) nothing to do
with problem mentioned by grant.


Greetz Erik


On 4/28/08, Paolo Nicoletti <[EMAIL PROTECTED]> wrote:
>
> Ok let's retry... plain text this time.
>
> Hello there,
> After having read that post you signaled (and the ones related to GC
> issues), I wrote a really simple Air application that scans one or more
> directories for actionscript files and checks their content to see whether
> or not every addEventListener has a corresponding removeEventListener set.
> You can find it here:
> http://www.genereavventura.com/app/addeventseeker/index.html
> Sometimes it can be useful.
> Paolo
>
> P.S. I apologizes for having sent this message twice...
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Question about the AIR security model...

2008-04-25 Thread EECOLOR
Describe type is quite a heavy operation. I am not sure if it would affect
this application though. It indeed is an easy solution :) Another solution
would be to call the
loader.contentLoaderInfo.applicationDomain.hasDefinition(name:String):Boolean
method.

As far as the original problem is concerned, my thoughts about it:

When you load content from another domain (which is the case when loading
swf's in AIR from another location) they will automatically be loaded into a
child application domain. This means that both parent (the domain of the AIR
application) and child domain (the domain of the
swf) contain an definition of IAnimatedItem.

If you then check if the swf implements the parent definition it will return
false. The parent definition is not the same as the child definition.


Greetz Erik

On 4/25/08, Ian Thomas <[EMAIL PROTECTED]> wrote:
>
> Oh, of course - describeType. Good solution. :-)
>
>
> Ian
>
>
> On Fri, Apr 25, 2008 at 9:14 AM, John Eriksson <[EMAIL PROTECTED]> wrote:
>
> >  I've actually solved my problem in an unorthodox way currently. I've
> written
> >  a check method
> >  that does a describeType on the content of the Loader and if it sees
> that it
> >  implements the proper interface
> >  and also has all the proper methods it oks the swf.
>
> ___
> 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] movement

2008-04-09 Thread EECOLOR
Why does Flash act the way it does? More information can be found here on
the blog of one of the Flash Player engeneers:

http://www.kaourantin.net/2006/05/frame-rates-in-flash-player.html


Greetz Erik


On 4/8/08, Cory Petosky <[EMAIL PROTECTED]> wrote:
>
> My buddy and I were playing with some performance benchmarks we wrote
> (put 100 bitmaps on the screen by manual blits to a backing
> BitmapData). We weren't surprised that it ran stably at 120 FPS in the
> Flash IDE. We were alarmed to discover, however, that the same SWF ran
> at a mere 80 FPS in the Flash standalone player and was just under 60
> FPS when viewed in the browser.
>
> Windows XP, Flash CS3 Professional, IE7.
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] IDE TextField TextFormat

2008-04-05 Thread EECOLOR
Nope, only to dynamic and input type textfields.


Greetz Erik

On 4/3/08, laurent <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
> Does TextFormat apply to none dynamic textfield ?
>
> thx
> L
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] some dying logic ...

2008-04-02 Thread EECOLOR
>granted that the eventListener was added with a weak reference

This seems to be one of the biggest mis-understandings these days. The
listener does *not*add a reference to the object that you are
listening too. For extensive discussion and proof of this issue you
can read the following thread:


http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg38700.html

In short: adding a listener to an object will only create a reference from
the object to the listener, not the other way around. This means that you
can remove the object without removing the listener, the object will then
still be garbage collected.


Greetz Erik


On 4/2/08, Meinte van't Kruis <[EMAIL PROTECTED]> wrote:
>
> granted that the eventListener was added with a weak reference
>
> On Wed, Apr 2, 2008 at 3:35 PM, EECOLOR <[EMAIL PROTECTED]> wrote:
>
> > *if (this.basicNews != null) {
>
> >this.basicNews.removeEventListener(RepeaterEvent.CLICK,
> > this.onNewsClicked);
> >   this.removeChild(this.basicNews);
> >   this.basicNews.die();
> >   this.basicNews = null;
> > }*
> >
> > In the above code I do not see why you would need any more then the
> > following lines:
> >
> > *basicNews = null;
> > removeChild(basicNews);*
> >
> > All references to basicNews are now removed and it is (along with its
> > children) marked for garbage collection. Calling the other extra methods
> > seems a waste of CPU.
> >
> >
> > Greetz Erik
> >
> >
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] some dying logic ...

2008-04-02 Thread EECOLOR
*if (this.basicNews != null) {
   this.basicNews.removeEventListener(RepeaterEvent.CLICK,
this.onNewsClicked);
   this.removeChild(this.basicNews);
   this.basicNews.die();
   this.basicNews = null;
}*

In the above code I do not see why you would need any more then the
following lines:

*basicNews = null;
removeChild(basicNews);*

All references to basicNews are now removed and it is (along with its
children) marked for garbage collection. Calling the other extra methods
seems a waste of CPU.


Greetz Erik


On 4/1/08, Cedric Muller <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I did develop a global process, in which my customized objects do have a
> 'die' method which is called in the end of an object's life in order to
> clean *everything* (like removing internal movieclips, sprites, listeners,
> timers, ..)
>
> this is what I came up with: the following block code is part of
> MyWhateverObject die method:
>
> //  basicNews is some basic Repeater 
> if (this.basicNews != null) {
>this.basicNews.removeEventListener(RepeaterEvent.CLICK,
> this.onNewsClicked);
>this.removeChild(this.basicNews);
>this.basicNews.die();
>this.basicNews = null;
> }
>
> my question is the following: when would you call the basicNews.die()
> method ? BEFORE or AFTER the 'this.removeChild(this.basicNews)' ?
>
> tia,
> Cedric
> ___
> 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] AS3 MouseEvent target?

2008-04-02 Thread EECOLOR
This behaviour can not emulated precisely because there is no way for us to
set the target and currentTarget properties. This is done by internal
EventDispatcher code.

The EventDispatcher code works something like this:

- check if the target property of the event has been set, if not set it
- set the currentTarget property
- check if the event has the bubbles property set to true
- check if the class is a DisplayObject
- check if the parent property is set
- clone the event and dispatch it at the parent and repeat the above steps


Greetz Erik


On 4/2/08, Meinte van't Kruis <[EMAIL PROTECTED]> wrote:
>
> so how does it work internally for displayObjects? Can a developer emulate
> this behaviours somehow?(cant imagine it since target and currentTarget
> are
> readonly)
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 MouseEvent target?

2008-04-02 Thread EECOLOR
> which is mouseChildren = false.

In my humble opinion I do not think this is what he needs. He should not be
referencing target, but instead he should reference currentTarget.

If you are adding a listener, the handlers e.currentTarget will point to the
object that you added the listener to, e.target is the object that initiated
the event (event bubbling).

So in a general way, where you in AS2 were using e.target you should now use
e.currentTarget. You only use
e.target if you want to reference the displayObject that initiated the event.



Greetz Erik


On 3/31/08, Steven Sacks <[EMAIL PROTECTED]> wrote:
>
> IMO, explaining Event Bubbling as the reason the TextField is the target
> is complicating the immediate solution he needs, which is mouseChildren =
> false.
>
> Yes, it's Event Bubbling that's causing the target to be the TextField.
>  To understand Event Bubbling, read about it in the docs, or better yet, in
> a book (like Moock's).  But, then you MUST do it yourself to learn how it
> works.  If you don't play with it yourself, you will never "get it" no
> matter how much somebody explains it to you.  I'm fully convinced of that.
>  You gotta mess around with it to fully understand why it's so amazingly
> awesome.
>
> ___
> 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] Interfaces

2008-04-01 Thread EECOLOR
An interface is used to make sure your code is not tightly coupled. Instead
of saying which class should be given, you say which interface should be
given. This means that a developer has more freedom to implement his own
version of an interface.

Lets say you make a person interface called IPerson. This interface has name
getters and setters:

*public interface IPerson
{
   function get name():String;
   function set name(name:String):void;
};*

Now you want to fill up a classroom. The only thing needed within the
classroom is the name of a person. To add a person to the classroom you call
the addPerson method. The class:

*public class ClassRoom
{
   public function addPerson(person:IPerson):void
   {
//do stuff with the person
   };
};*

The addPerson method has a person argument typed as IPerson. This means that
I can give any type of instance to this function as long as it implements
the IPerson interface. This interface makes sure that the class given to the
addPerson method has a name getter and setter.

An example of a person:

*class Jack implements IPerson
{
   private var _name:String;

   public function get name():String
   {
   return _name;
   };

   public function set name(name:String):void
   {
  _name = name;
   };
};*

How my class implements the IPerson interface does not matter to the
ClassRoom class. The only thing the ClassRoom class is interested in is the
name getter and setter.

There are a few cases where interfaces come in handy:

- If you want to be able to easialy switch an implementation without
breaking existing code
- If you are using a module and want to call (from the module) a method in
your framework. The framework should be typed as an interface to prevent it
from being compiled into the module.
- If you are not taking care of the actual implementation (another developer
will write this piece of code), you only want a certain method to be
available because you are using this implementation.
- To give freedom to other developers of your code
(mx.core.UIComponentimplements IUIComponent in Flex. And within Flex
everything is typed as
IUIComponent. This means you could write your own version of IUIComponent if
needed.

On a side note. On complex applications I start with writing interfaces for
every part of my application to prevent me from writing actual code and
thinking about the structure. This approach has only personal benefits and
has officially no added value except for the ones named above (in a later
stage).


Greetz Erik

On 4/1/08, Omar Fouad <[EMAIL PROTECTED]> wrote:
>
> Yeah, but I've read that a Class that implements an interface an call
> function from other classes that allready extends other Classes.
> it's like a multiple inheritance. But how can I achieve it?
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] TextFieldAutoSize [AS3]

2008-04-01 Thread EECOLOR
Indeed, if you set the width of a TextField and autoSize to LEFT, it will
automatically resize only the height.


Greetz Erik


On 4/1/08, Andrew Murphy <[EMAIL PROTECTED]> wrote:
>
> You can also do it like this:
>
> var tf:TextField = new TextField();
> with(tf){
> autoSize = TextFieldAutoSize.LEFT;
> wordWrap = true; // width wordWrap set to true it autosizes
> // the height to fit the text
> w = 300;
> text = "Blahblahblah yackitty schmackity."
> }
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing vars with the the timer and events

2008-03-14 Thread EECOLOR
I have modified my test classes slightly. And found that when debugging this
movie in Flex Builder 3, the garbage collection was triggered when I moved
my mouse within the Flash movie.

I suspect that the method behind the screens that runs the garbage collector
is quite complex. I think that in more complex applications garbage
collection is more efficient.


Counter.as

package
{
   import flash.display.BitmapData;

   public class Counter
   {
  public var bmd:BitmapData;

  public function Counter()
  {
 bmd = new BitmapData(500, 500);
 bmd.noise(Math.random() * 100);
  };
   };
};


SpriteClass.as

package
{
   import flash.display.Sprite;

   public class SpriteClass extends Sprite
   {
  public function SpriteClass()
  {
  };
   };
};


testAS.as

package
{
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.text.TextField;

   [SWF(frameRate="4")]
   public class testAS extends Sprite
   {
  private var _t:TextField;
  private var _c:uint;
  private var _a:Array;

  public function testAS()
  {
 _a = new Array();

 _t = new TextField();
 addChild(_t);

 var a:SpriteClass = new SpriteClass();
 a.addEventListener(Event.ENTER_FRAME, _handler);
  };

  private function _handler(e:Event):void
  {
 _t.text = _c.toString();

 _a.push(new Counter());

 _c++;

 if (_c > 300)
 {
(e.currentTarget as SpriteClass).removeEventListener(
Event.ENTER_FRAME, _handler);
 };
  };
   };
};



Greetz Erik




On 3/14/08, EECOLOR <[EMAIL PROTECTED]> wrote:
>
> Hey there,
>
> I was totally shocked this morning. If what you were saying was true it
> would mean that if you created a class with a listener to itself and
> instantiated it, it would never be garbage collected.
>
> So I did some extra tests.
>
> 1. Your example with a weak listener (same result)
> 2. Trying to force garbage collection using System.gc and the
> localconnection 'hack' (same result)
>
> So I turned to the Flex
> Profiler. I used the following class to test things:
>
> package
> {
>import flash.display.Sprite;
>import flash.events.Event;
>import flash.system.System;
>import flash.text.TextField;
>
>[SWF(frameRate="1")]
>public class testAS extends Sprite
>{
>   private var _t:TextField;
>   private var _c:uint;
>   private var _a:Array;
>
>   public function testAS()
>   {
>  _a = new Array();
>
>  _t = new TextField();
>  addChild(_t);
>
>  var a:SpriteClass = new SpriteClass();
>  a.addEventListener(Event.ENTER_FRAME, _handler);
>   };
>
>   private function _handler(e:Event):void
>   {
>  _t.text = (_c++).toString();
>  _a.push(new Counter());
>   };
>};
> };
>
> Initialy the profiler showed the behaviour you were describing. However,
> if I pressed
> the "Run Garbage Collector" button, the instance of SpriteClass was removed. 
> This indicates the behaviour that I described in my example.
>
>
> I changed the above example to use a weak listener. The instance of 
> SpriteClass was only removed after I clicked the "Run garbage collector" 
> button.
>
> In the handler I removed the listener to the SpriteClass instance. The
> instance of SpriteClass was only removed from memory after I clicked
> the "Run garbage collector" button.
>
> If I run the profiler with the
> option "Generate object allocation stack traces", the instance is removed 
> everytime quite fast.
>
>
> The conclusion of all this is that my statement in previous emails was
> correct. What your example shows is that while the instance _can_ be garbage
> collected, you will never know when it actually will.
>
>
> A summary:
>
> - There is no such thing as "a reference to be created invisibly within
> the event system".
> - You can not be sure when an instance is garbage collected.
> - Weak references only indicate that: if the reference on the dispatcher
> object to the listener is the last one, the instance containing the listener
> will me available for garbage collection.
>
>
> I want to thank you Cory for being as persistent as I can be. It enabled
> me to do extensive tests to see
> how the player works. In my tests in a standalone player there were cases 
> where I let the example application run for more then half an hour without 
> garbage collection of SpriteClass. I am not sure when the garbage collector 
> kicks in (might be triggered by total memory usage). I will continue to 
> monitor the
> example
> to see if the instance will ever be garbage collected. If not, I will file a 
> bug at adobe.
>
>
>
> Greetz Erik
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing vars with the the timer and events

2008-03-14 Thread EECOLOR
Hey there,

I was totally shocked this morning. If what you were saying was true it
would mean that if you created a class with a listener to itself and
instantiated it, it would never be garbage collected.

So I did some extra tests.

1. Your example with a weak listener (same result)
2. Trying to force garbage collection using System.gc and the
localconnection 'hack' (same result)

So I turned to the Flex Profiler. I used the following class to test things:

package
{
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.system.System;
   import flash.text.TextField;

   [SWF(frameRate="1")]
   public class testAS extends Sprite
   {
  private var _t:TextField;
  private var _c:uint;
  private var _a:Array;

  public function testAS()
  {
 _a = new Array();

 _t = new TextField();
 addChild(_t);

 var a:SpriteClass = new SpriteClass();
 a.addEventListener(Event.ENTER_FRAME, _handler);
  };

  private function _handler(e:Event):void
  {
 _t.text = (_c++).toString();
 _a.push(new Counter());
  };
   };
};

Initialy the profiler showed the behaviour you were describing. However, if
I pressed
the "Run Garbage Collector" button, the instance of SpriteClass was
removed. This indicates the behaviour that I described in my example.

I changed the above example to use a weak listener. The instance of
SpriteClass was only removed after I clicked the "Run garbage
collector" button.

In the handler I removed the listener to the SpriteClass instance. The
instance of SpriteClass was only removed from memory after I clicked
the "Run garbage collector" button.

If I run the profiler with the
option "Generate object allocation stack traces", the instance is
removed everytime quite fast.


The conclusion of all this is that my statement in previous emails was
correct. What your example shows is that while the instance _can_ be garbage
collected, you will never know when it actually will.


A summary:

- There is no such thing as "a reference to be created invisibly within the
event system".
- You can not be sure when an instance is garbage collected.
- Weak references only indicate that: if the reference on the dispatcher
object to the listener is the last one, the instance containing the listener
will me available for garbage collection.


I want to thank you Cory for being as persistent as I can be. It enabled me
to do extensive tests to see
how the player works. In my tests in a standalone player there were
cases where I let the example application run for more then half an
hour without garbage collection of SpriteClass. I am not sure when the
garbage collector kicks in (might be triggered by total memory usage).
I will continue to monitor the
example
to see if the instance will ever be garbage collected. If not, I will
file a bug at adobe.



Greetz Erik



On 3/14/08, EECOLOR <[EMAIL PROTECTED]> wrote:
>
> Oh man, thank you for this example!
>
> This totally blows me away. I am sorry I was so persistent. You are
> correct. I will have to check all my applications now, hehe.
>
> This also means that all my earlier arguments are incorrect and that the
> use of Delegate is indeed very dangerous.
>
> Thank you for showing this to me! To me this really is unexpected
> behaviour... I just can not believe that this is designed behaviour...
>
>
>
> Greetz Erik
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing vars with the the timer and events

2008-03-14 Thread EECOLOR
Oh man, thank you for this example!

This totally blows me away. I am sorry I was so persistent. You are correct.
I will have to check all my applications now, hehe.

This also means that all my earlier arguments are incorrect and that the use
of Delegate is indeed very dangerous.

Thank you for showing this to me! To me this really is unexpected
behaviour... I just can not believe that this is designed behaviour...



Greetz Erik



On 3/13/08, Cory Petosky <[EMAIL PROTECTED]> wrote:
>
> > There is no such thing as "a reference to be created invisibly within
> the event system".
>
>
> I disagree. Try this test code:
>
> package {
> import flash.events.Event;
> import flash.display.Sprite;
> import flash.utils.getTimer;
>
> public class TestClass extends Sprite {
> public function TestClass() {
> trace("Started!");
> var s:Sprite = new Sprite();
> s.addEventListener(Event.ENTER_FRAME, listener);
> addEventListener(Event.ENTER_FRAME, listener);
> }
>
> private function listener(event:Event):void {
> trace(event.currentTarget.toString() +
> getTimer());
> }
> }
> }
>
> You'll see both event handlers fire until the end of time.  Event
> references actually are kept, invisibly, within the event system.
>
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Running Independent SWF

2008-03-13 Thread EECOLOR
It is just a guess, but is the url in your swf "/video/pic_8.swf"? If so,
you might want to change it to "video/pic_8.swf" (without the slash at the
start). The slash at the start is only usefull if you are serving your swf
from a webserver.


Greetz Erik


On 3/13/08, Marc Hoffman <[EMAIL PROTECTED]> wrote:
>
> Anuj,
>
> I know this is more of a hack than really fixing the problem, but
> have you tried keeping all swf's in the same directory? I am
> suspicious of the URL: file:///video/pic_8.swf. Why so many directory
> levels in the path?
>
>
> - Marc
>
>
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing vars with the the timer and events

2008-03-13 Thread EECOLOR
>If you add a normal event listener to a child,
>and then remove that child, the child is _not_ garbage collected.
>Objects are only garbage collected when all references to the object
>are removed. Adding a normal event listener causes a reference to be
>created invisibly within the event system.


I think this is where we disagree. If a parent adds a listener to a child,
this means the child has a reference to the parent, not the other way
around. What you call the event system can be thought of as an array
with handler methods on the child instance. This means that if you add
a normal event listener to a child and then remove it, it will be
garbage collected. There is no such thing as "a
reference to be created invisibly within the event system".

>You can't use weak references on an anonymous event listener.

In my last email I agreed with you on this :)

>You must remove all normal listeners from an object before it will be
>garbage collected.

Again, I do not think this is correct. An object will be garbage collected
if there are no references to it. Adding listeners to an object will not
create references to the object itself.


An example (not usefull, but to illustrate the point):

package
{
   class TestClass
   {
  public function TestClass()
  {
 var o:EventDispatcher = new EventDispatcher();
 o.addEventListener(Event.COMPLETE, _handler);
  }; // At this point o will be marked for
garbage collection, no references to o left.

  private function _handler(e:Event):void
  {
  };
   };
};


Another example (again not usefull, but to illustrate the point):

package
{
   class TestHandler
   {
  public function TestHandler()
  {
  };

  public function handler(e:Event):void
  {
  };
   };
};

package
{
   import flash.display.Sprite;

   class TestClass extends Sprite
   {
  public function TestClass()
  {
 var o:TestHandler = new TestHandler();
 stage.addEventListener(Event.RESIZE, o.handler);

  }; // At this point o will not be marked for garbage collection, stage
will still have a reference to it.
   };
};


I hope you agree on this. If not I am open to convincing arguments :)



Greetz Erik


On 3/13/08, Cory Petosky <[EMAIL PROTECTED]> wrote:
>
> >  The common use for weak event
> >  listeners is when adding listeners to the stage
>
>
> I disagree. Weak event listeners should be used in nearly all cases.
>
>
> >  In most cases there is actually no real benefit of creating weak event
> >  listeners. In most cases parents add
> >  listeners to their children. Children are removed and that's that.
>
>
> This is not correct. If you add a normal event listener to a child,
> and then remove that child, the child is _not_ garbage collected.
> Objects are only garbage collected when all references to the object
> are removed. Adding a normal event listener causes a reference to be
> created invisibly within the event system.
>
> You must remove all normal listeners from an object before it will be
> garbage collected.
>
>
> > Hmmm, if it was garbage collected, why would I remove the listener, isnt
> >  that the point of weak references?
>
>
> You can't use weak references on an anonymous event listener. The only
> reference to that function is in the event system itself, so if you
> use a weak reference, the garbage collector considers the anonymous
> function eligible for garbage collection. Thus, the garbage collector
> removes your event listener immediately, and you never get your event.
>
> (When I say "immediately," I really mean "at a random time when the GC
> is invoked." Sometimes that's immediate, sometimes its not, but you
> should assume immediacy so your code doesn't randomly break.)
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing vars with the the timer and events

2008-03-13 Thread EECOLOR
>That's a dangerous practice.

I do not completely agree.

>It prevents you from using weak event listeners

Correct.

The common use for weak event
listeners is when adding listeners to the stage: the stage is allways
present and adding normal listeners to it will insure that the
listener will persist. Even if it is removed everywhere else.

In most cases there is actually no real benefit of creating weak event
listeners. In most cases parents add
listeners to their children. Children are removed and that's that. If
the parent gets removed: no problem.

In the majority of the cases, the creation of listeners on a parent is bad
practice (stage is one of those exceptions).


> Now have to manually remove your listener to
> make sure your object is garbage collected -- but the only way to
> remove event listeners is to pass the removeEventListener function a
> reference to the function you want to remove... but you don't have
> that reference!

Hmmm, if it was garbage collected, why would I remove the listener, isnt
that the point of weak references?


Greetz Erik


On 3/12/08, Cory Petosky <[EMAIL PROTECTED]> wrote:
>
> That's a dangerous practice. It prevents you from using weak event
> listeners -- because the only reference to your delegate function
> object is the event listener itself, a weakly-referenced listener will
> be garbage collected. Now have to manually remove your listener to
> make sure your object is garbage collected -- but the only way to
> remove event listeners is to pass the removeEventListener function a
> reference to the function you want to remove... but you don't have
> that reference!
>
> If it's a one-time event, you can have the listener remove itself.
> Your delegate function object can pass a reference to itself (using
> arguments.callee) in to the "real" event listener function, which you
> can use to remove the listener. In any other case, you'll have to
> build a separate data structure (usually a Dictionary of Objects ->
> Functions) to keep a reference available to your code.
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] [AS3] Memory leaks & unloading

2008-03-12 Thread EECOLOR
In Flex Builder 3 they have added the profiler. You can use that to take
snapshots of your application and inspects its memory use, instantiated
objects etc.


Greetz Erik

On 3/12/08, Henry Cooke <[EMAIL PROTECTED]> wrote:
>
> Wow, thanks for all the tips, guys. I forgot to mention that I was
> removing all my listeners, too, but weak referencing definitely looks
> useful, as does the rest of the stuff that Mr Skinner's written on
> resource management. And I'll dig into my copy of Moock as soon as I
> get the chance.
>
> Thanks again! Any more suggestions welcome, of course ;)
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing vars with the the timer and events

2008-03-12 Thread EECOLOR
If we ever he need to pass extra arguments to the handler we use a delegate
class to pass them. Usage:

obj.addEventListener(Event.TYPE, Delegate.create(this, _handler, arg1,
arg2));

private function _handler(e:Event, arg1:Object, arg2:Object):void
{

};

I added our delegate class as an attachment.

Note that for class methods the scope (first argument of the create method)
has no influence.


Greetz Erik


On 3/12/08, Helmut Granda <[EMAIL PROTECTED]> wrote:
>
> Hi Bob,
>
> Thanks for the comment, that is the route that started working on after
> posting the question and the only issue I am having is dispatching the
> custom event when the timer has been reached, I did a soft search for
> samples of extending the Timer Class with custom TimerEvents but wasnt
> able
> to find any would you happen to know where I could find more info?
>
> Thanks!!
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] LoaderContext question

2008-03-09 Thread EECOLOR
Within Flex builder I got it working like this:

ITestAS.as
package
{
   public interface ITestAS
   {
  function get testVar():String;
   };
};


TestAS1.as
package
{
   import flash.display.DisplayObjectContainer;
   import flash.display.Loader;
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.net.URLRequest;
   public class TestAS1 extends Sprite
   {
  private var _loader:Loader;
  public function TestAS1()
  {
 _loader = new Loader();
 _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
_loadCompleteHandler);
 _loader.load(new URLRequest("TestAS2.swf"));
  }
  private function _loadCompleteHandler(e:Event):void
  {
 var testAS2:ITestAS = ITestAS(_loader.content);
 trace(testAS2.testVar);
  };
   };
};



TestAS2.as
package
{
   import flash.display.Sprite;

   public class TestAS2 extends Sprite implements ITestAS
   {
  public function TestAS2()
  {
  };
  public function get testVar():String
  {
 return "hello";
  };
   };
};


I recall vaguely that I once tried this with an swf created in the Flash IDE
and that we needed to get the firstChild. You can use describeType to
navigate to content and its children to see where the class you need is
located.


Greetz Erik



On 3/7/08, Dave Segal <[EMAIL PROTECTED]> wrote:
>
> I am getting a type Coercion error. "TypeError: Error #1034: Type Coercion
> failed"
>
> Really the whole goal here is to be able to load swfs (from a different
> server) that implement some public api. Then have the loading swf cast the
> loaded swf to that api, so code hints and type checking are available. Are
> there any solutions for this type of thing?
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] LoaderContext question

2008-03-06 Thread EECOLOR
>From the top of my head, I think it should be:

var _lm:LoadMe = LoadMe(_ldr.content.getChildAt(0));


Greetz Erik


On 3/7/08, Andrei Thomaz <[EMAIL PROTECTED]> wrote:
>
> what is the error?
>
> []'s
>
> andrei
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] bitMapData - function optimization

2008-02-28 Thread EECOLOR
You could use the paletMap function or the threshold function of the
bitmapData object. Check the documentation for details.


Greetz Erik


On 2/28/08, Karim Beyrouti <[EMAIL PROTECTED]> wrote:
>
> Hello Hello,
>
> Just wondering if anyone has any tips or ideas on optimizing this
> function,
> as its really slow.. Basically, it creates an inverted alpha mask from a
> bitmap by going through every pixel in the bit map.
>
> Here is the function:
>
> 
>
> private function createInvertedMask() {
>
> var w:Number = mask_bitmap.width;
> var h:Number = mask_bitmap.height;
>
> var r:Number = 0;
> var c:Number = 0;
> var v:Number;
>
> for ( r = 0 ; r < w ; r++ ) {
>
> for ( c = 0 ; c < h ; c++ ) {
>
> v = mask_bitmap.getPixel32( r, c );
>
> if ( v == 0 ) {
>
> mask_bitmap.setPixel32( r, c ,
> 0xFF00  );
>
> } else {
>
> mask_bitmap.setPixel32( r, c ,
> 0x  );
>
> }
> }
> }
>
> }
>
> 
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] BitmapData.paletteMap ()

2008-02-27 Thread EECOLOR
So if I understand you correctly, your question actually is: "how do I find
out which colors are used in my bitmap data?".

I am sorry to disappoint you, but I do not have an answer for you. The only
solution I could come up with is looping through the pixels (see the code at
the end of the email). This loop however is too slow. On my fast machine it
took about 2.4 seconds for an image of 2000 x 2000. If time is not an issue
you could split the loop over multiple frames so you can show a progress
bar.

Maybe someone has a better idea for you...


Greetz Erik


var byteArray:ByteArray = bmd.getPixels(new Rectangle(0, 0, bmd.width,
bmd.height));
var red:Array = new Array();
var green:Array = new Array();
var blue:Array = new Array();
var color:uint;
var redColor:uint;
var greenColor:uint;
var blueColor:uint;
byteArray.position = 0;
while (byteArray.bytesAvailable)
{
color = byteArray.readUnsignedInt();
redColor = (color >> 16) & 0xFF;
greenColor = (color >> 8) & 0xFF;
blueColor = (color) & 0xFF;
if (!red[redColor])
{
red[redColor] = redColor;
};
if (!green[greenColor])
{
green[greenColor] = greenColor;
};
if (!blue[blueColor])
{
blue[blueColor] = blueColor;
};
};








On 2/27/08, Elia Morling <[EMAIL PROTECTED]> wrote:
>
> As indicated in earlier post I need to swap the palettes of a bitmapdata.
>
> "public function paletteMap(sourceBitmapData:BitmapData,
> sourceRect:Rectangle, destPoint:Point, redArray:Array = null,
> greenArray:Array = null, blueArray:Array = null, alphaArray:Array =
> null):void
> Remaps the color channel values in an image that has up to four arrays of
> color palette data, one for each channel."
>
> That is excellent, but how do I extract the current color channel values
> as
> arrays so that I can maniuplate them?
>
> Elia
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Flex Disables Browser Scrollbars?

2008-02-27 Thread EECOLOR
I think a better answer will be given on the flexcoders mailing list.

Greetz Erik

On 2/27/08, Elia Morling <[EMAIL PROTECTED]> wrote:
>
> How do I make it so that the html that flex generates doesn't disable the
> browser scrollbards?
> I have located the lines of html code that does this, but it's tedious to
> manually change them.
>
> Thanks
> Elia
> _
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Flex only generates errors for my Document Class, but not in any other AS file

2008-02-27 Thread EECOLOR
Make sure your classes are referenced from your document class.


Greetz Erik


On 2/26/08, Johan Nyberg <[EMAIL PROTECTED]> wrote:
>
> Hi, I was wondering if anyone has encountered this problem: I use Flex
> as an IDE when developing flash. When I code, Flex only displays
> errors in my document class, but not in any other AS file. Do I have
> to set something in the settings?
>
> Regards,
>
> Johan Nyberg
> Designer and web developer
>
> [EMAIL PROTECTED]
> 08 - 50 00 24 30
> 070 - 407 83 00
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Re: RangeError: Error #2006: The supplied index is out of bounds.

2008-02-27 Thread EECOLOR
You can use numChildren to check how many children a DisplayObjectContainer
has.


Greetz Erik

On 2/26/08, anuj sharma <[EMAIL PROTECTED]> wrote:
>
> I will loop it and see what will happen
> Thanks a lot for all your help
>
> Anuj
>
>
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] (AS3) use input textfield in a loaded swf

2008-02-23 Thread EECOLOR
Most likely you just need to do this:

textField.type = TextFieldType.INPUT;


Greetz Erik

On 2/23/08, Radley Marx <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I know this is a basic one, but I've been stuck for over an hour on
> this...
>
> I'm loading a swf which contains an input textField. For some reason,
> I can't type into the field. I can pass a new .text value to change
> it, but simply can't hand edit it...
>
> What's the new process for doing this?
>
>
> thnx
>
> -radley
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] saving image locally

2008-02-23 Thread EECOLOR
If you are developing for flash player 9 you can do the following:

1. Convert your image to a png or jpg using:
http://weblogs.macromedia.com/cantrell/archives/2006/08/actionscript_pn.cfm
2. Send the image to your server which will write it to a temporary
directory on the server
3. Use fileReference.download to offer the image to the user


Greetz Erik



On 2/21/08, ben gomez farrell <[EMAIL PROTECTED]> wrote:
>
> Yes, basically you need to send the bits up to a server side script as
> POST data.  Instead of having your server side script save it to the
> server, you'd have the server side script pop up a "Save as:" dialog -
> which you could then use the dialog to save the file.
>
> The details are a bit tricky when you first try it, but I've done it
> with PHP.  The only drawback is that it needs to go up to the server and
> come back down again - you can't just do everything client side as far
> as I know.
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Question on garbage collection

2008-02-18 Thread EECOLOR
That all looks fine. There is no memory leak in the code you showed here.

You do not need to delete tTime as it is declared within the scope of the
function and will be marked for deletion as soon as the function is
complete.

If I run the classes (with the line clockdata = new
ClockData() commented out), the memory is stable in the stand alone
player. In flash the memory is slowly going up, but that is because we
are doing a trace each interval.

Note that it takes a few seconds for the memory to be stable.


Greetz Erik



On 2/18/08, Jiri Heitlager <[EMAIL PROTECTED]> wrote:
>
> Erik,
>
> it would be something like this:
>
> var c:Clock = new Clock();
> getTime()
>
> setInterval(this , 'getTime' , 1000)
>
> function getTime()
> {
> var tTime:Time = c.getElepasedTime()
> trace(tTime.serialize())
> delete tTime; // is this neccessary and if so, is tTime = null
> maybe
> better ???
> }
>
>
>
>
> EECOLOR wrote:
> > Could you post the code that actualy calls these methods?
> >
> >
> > Greetz Erik
> >
> >
> > On 2/15/08, Jiri Heitlager <[EMAIL PROTECTED]> wrote:
> >> Thanks for your reply Bob, it is for AS2. I read a lot of articles
> about
> >> it and understand the general concept. That is why I post the question.
> >> If I understood correctly the posted code should not leave any objects
> >> unreferenced and therefor cleared for deleting.
> >> But the memory goes up anyway. I tested it with only this two classes
> >> instantiated and nothing else.
> >>
> >> I am hoping somebody can take a look at the code I posted and give me
> >> the reassurence that I am doing things correctly.
> >>
> >> Jiri
> >>
> > ___
> > 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] Question on garbage collection

2008-02-17 Thread EECOLOR
Could you post the code that actualy calls these methods?


Greetz Erik


On 2/15/08, Jiri Heitlager <[EMAIL PROTECTED]> wrote:
>
> Thanks for your reply Bob, it is for AS2. I read a lot of articles about
> it and understand the general concept. That is why I post the question.
> If I understood correctly the posted code should not leave any objects
> unreferenced and therefor cleared for deleting.
> But the memory goes up anyway. I tested it with only this two classes
> instantiated and nothing else.
>
> I am hoping somebody can take a look at the code I posted and give me
> the reassurence that I am doing things correctly.
>
> Jiri
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Exporting AS2 classes across multiple frames?

2008-02-12 Thread EECOLOR
I might be wrong here, but if I recall correctly you can in fact load all
your classes in frame 2. Make sure none of your MovieClips have the 'export
in first frame' option enabled and place those MovieClips in frame 2.

As for your other non-visual classes, just make sure they are not called
within frame 1. Your preloader script in frame one should run before
everything else has been loaded. If I remember well, this is the technique
used in Flex 1.5 and 2.0.


Greetz Erik


On 2/12/08, Hans Wichman <[EMAIL PROTECTED]> wrote:
>
> Hi,
> you can put classes in an swf and use the swf as a dll.
> It's a hassle but its doable.
>
> You load the swf in a specific frame, the swf only contains classes and
> they
> become available from that frame onwards.
> Again, im not sure if you should do this if the only reason is that you'd
> rather write the preloader in as2 instead of as1.
> It's a great opportunity to hack timelime as1 you know and nowadays those
> chances are slim:))
>
> greetz
> JC
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Multiple moviecliploaders

2008-02-12 Thread EECOLOR
If I remember well the MovieClip loader can only load 2 images
simultaniously. This also might be a browser restriction.


Greetz Erik


On 2/12/08, Muzak <[EMAIL PROTECTED]> wrote:
>
> Get rid of the nested function, avoid it at all times (IMO).
>
>
> var img_mcl:MovieClipLoader;
>
> function onLoadInit(t:MovieClip) {
> main.hideMc(t);
> }
> function loadImage(imagePath, targetMc) {
> var container_mc:MovieClip = targetMc.img_mc;
> var loading_mc:MovieClip = targetMc.loading_mc;
> img_mcl.loadClip(imagePath,container_mc);
> }
> img_mcl = new MovieClipLoader();
> img_mcl.addListener(this);
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Dynamically animating writing effect

2008-02-10 Thread EECOLOR
Whow, tough task...

If I were given that assignment I would check out this application:

http://www.sephiroth.it/file_detail.php?id=159#

It allows you to read font information. This font information allows you to
draw the font using information available in the font file itself. If I am
correct the application draws the font using an included graphics library.

If you end up using this for your application I would recommend you to
consider to donate something using the paypal button on that page.


Greetz Erik


On 2/10/08, ali drongo <[EMAIL PROTECTED]> wrote:
>
> Hiya, I am wanting to create an effect where text will appear on the
> screen
> as if it is being written by a pen. I am going to set about writing a
> class
> to achieve this and wanted to get the group's thoughts on if I am going
> about this the right way.
> My idea is that I could create all of my text in textfield then convert
> the
> textfield somehow into a BitmapData object, then I could use the
> BitmapData
> class to scan through the image starting at the top left and figure out
> which pixels are coloured by the text and then I duplicate the BitmapData
> object and colour the pixels gradually. My class would need to know which
> angle the text should be appearing (writing) in. The font I use would have
> to use 'joined up' writing also obv.
>
> Does anyone think this would work or is there a simple way to achieve what
> I
> am looking to do?
>
> Thanks,
> Ali
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Dynamic upload of bunch of images with automaticsmooth.

2008-02-04 Thread EECOLOR
Another problem here may be the quality property on the object/embed tag. If
it is auto high it might for some cases switch to non-smoothing to benefit
the performance. This will change if you set the property to high.


Greetz Erik

On 2/3/08, Muzak <[EMAIL PROTECTED]> wrote:
>
> Check the example in the docs.
> You need to create a copy of the original (loaded) image, add it to the
> display list and remove the (original) loaded image
>
>
> http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Bitmap.html
>
> Here's an example of loading an image and displaying a copy next to it:
>
> import flash.display.Loader;
> import flash.net.URLRequest;
> import flash.display.Bitmap;
>
> var loader:Loader;
> var req:URLRequest;
> var orig_mc:MovieClip;
> var copy_mc:MovieClip;
>
> function loaderCompleteHandler(evt:Event) {
> var ldr:Loader = evt.currentTarget.loader as Loader;
> var origImg:Bitmap = (ldr.content as Bitmap)
> origImg.width = 200;
> origImg.height = 150;
>
> var image:Bitmap = new Bitmap(origImg.bitmapData, "auto", true);
> image.width = 200;
> image.height = 150;
> copy_mc.addChild(image);
> }
>
> loader = new Loader();
> req = new URLRequest("2.jpg");
> loader.load(req);
> loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
> loaderCompleteHandler);
>
> orig_mc = new MovieClip();
> orig_mc.addChild(loader);
> addChild(orig_mc);
>
> copy_mc = new MovieClip();
> copy_mc.x = 210;
> addChild(copy_mc);
>
>
> regards,
> Muzak
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Bundle swf's on server for transport to client

2008-02-04 Thread EECOLOR
>In the Flash app we are having some trouble with the attachMovie method and
the fact that you can only attach a mc on the same parent.

What you could do here (if you are developing for Flash 8) is put a method
in you library like this (might contain errors, wrote it from the top of my
head):

function getImageBitmapData(linkageID:String, width:Number,
height:Number):BitmapData
{
   var currentImage:MovieClip = attachMovie(linkageID, "currentImage", 0);

   var bmd:BitmapData = new BitmapData(width, height);
   bmd.draw(currentImage);

   //remove the movieclip
   currentImage.removeMovieClip();
   //make sure it is removed
   delete this.currentImage;

   return bmd;
};

Then where you use the component you could draw it with attachBitmap or
bitmapFill. I suspect you resize the images aswell. In that case at the end
of the resize just get a new bitmapData (during might be too heavy,
something to test I guess).


Greetz Erik


On 2/4/08, Gert-Jan van der Wel <[EMAIL PROTECTED]> wrote:
>
> Hi Erik,
> Thank you for your response. I know that something like this should be
> possible in AS3 but we're (at this moment) stuck with AS2, so that makes
> it
> a little bit more difficult.
>
> On our server we've been testing with Swfmill and Ming, but we keep
> getting
> an error rate of about 10% with the bundling our furniture swf's to one
> big
> swf. In the Flash app we are having some trouble with the attachMovie
> method
> and the fact that you can only attach a mc on the same parent.
>
> Therefor we decided to stop our attempt. We'll continue our quest when the
> main app is AS3 ;-)
>
> Cheers,
> Gert-Jan
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 type coercion error

2008-02-02 Thread EECOLOR
The only thing I can think of is that it is most likely
a problem concerning the ApplicationDomain. You probably load the swf into
its own application domain, which means it will use the AbstractPreloader
class of the swf instead of the one in your main application. The solution
here would be to load the swf like this:

var context:LoaderContext = LoaderContext(false,
ApplicationDomain.currentDomain = null, SecurityDomain.currentDomain);

loader.load("my.swf", context);


Greetz Erik


On 1/18/08, Steven Sacks <[EMAIL PROTECTED]> wrote:
>
> I am loading in a SWF with a document class of PreloadPage, which
> extends AbstractPreloader. When I try to cast _loader.content as the
> super class, I get a coercion error.
>
> TypeError: Error #1034: Type Coercion failed: cannot convert
> [EMAIL PROTECTED] to com.gaiaframework.pages.AbstractPreloader.
>
> var _preloader:AbstractPreloader;
> _preloader = AbstractPreloader(_loader.content);
>
> public class PreloadPage extends AbstractPreloader implements IPreloader
> {
>
> public class AbstractPreloader extends AbstractBase implements IPreloader
> {
>
> Can somebody please explain why I can't cast a subclass as its parent
> class in this case?  This doesn't make sense to me...
>
> --
> Steven Sacks
> Flash Maestro
> Los Angeles, CA
> -
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Question about Arrays

2008-02-02 Thread EECOLOR
>I believe it's type * so you should cast it.

This has nothing to do with that, hehe. There is a tiny difference beween
ClassToCastTo(value) and (value as ClassToCastTo). In the first case a
compiler error will be thrown. In the second case the cast will be tried. If
it fails the resulting value will be a null value.

>why is -it- working

The pop method is typed as Object. Object is a dynamic class which means you
can add properties at
runtime. This in turn means that the compiler can not complain about
you calling a property that might not exist as you might be adding it
'dynamically' before you call it,


Greetz Erik


On 1/12/08, Mark Winterhalder <[EMAIL PROTECTED]> wrote:
>
> On Jan 11, 2008 11:34 PM, Mark Lapasa <[EMAIL PROTECTED]> wrote:
> > I too would expect that it would need to be casted.
>
> Yes, one would think so.
>
> I can't answer your question, either, but can't help but note that in
> haXe you would declare your array as Array. The compiler
> wouldn't let you put anything else into it, and likewise, everything
> you'd pull out would be of type MyClass. haXe has a great type system
> (including implied types and type templates), so if you're the kind of
> coder that wonders about issues like that, I recommend you have a llok
> at .
>
> Mark
> ___
> 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] How to call custom method on loaded AS3 swf?

2008-02-02 Thread EECOLOR
This is the perfect example as to where you would use an interface:

Interface definition:

public interface MyFrameworkInferface
{
   function startup():void
};


Class in the swf that is loaded in:

public class MyLoadedClass
{
   public function startup():void
   {
   /stuff
   };
};


Accessing the method:

var loadedClass:MyFrameworkInterface = MyFrameworkInterface(
gameLoader.content);
loadedClass.startup();


>I just needed to compile the class into my View

In most cases you want to prevent the main application from compiling
specific classes used in swf that are loaded
in. Interfaces are a perfect solution here, they act as the contract
between the loader and the loaded.


Greetz Erik

On 1/13/08, Adrian Park <[EMAIL PROTECTED]> wrote:
>
> Thanks all for your replies. Slight delay in responding due to trying to
> solve the problem whilst trying to make tangible progress on the project
> at
> the same time!
> Muzak, although I didn't try your suggestion, I suspect it would have
> worked
> but I feel it's much the same as the solution I used in the sense that
> it's
> tricking the compiler. If I'm tricking the compiler it means I probably
> haven't understood something properly and that keeps me awake at night :)
>
> Steven, thanks for that link. It's very interesting but, in this case, my
> initial instinct and August's suggestion was correct - I just needed to
> compile the class into my View and then cast gameLoader.content when I
> want
> to access its custom methods/properties.
>
> August - you were exactly right! I had tried this before but, what I
> discovered was that the game I was loading (authored by someone else) was
> throwing a runtime error when I tried to run it and I had misinterpreted
> the
> error as a problem with my code. Weirdly, this runtime error was not
> thrown
> when I ran the game on its own! Anyway, I tracked down and fixed the
> problem
> in the game code and now all is working well.
>
> August, if you want to discuss our frameworks and MVC further, feel free
> to
> contact me direct at [EMAIL PROTECTED]
>
> Thanks all,
>
> Adrian Park
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Video has no mouseEnabled, help (AS3)

2008-02-02 Thread EECOLOR
In case this doesnt help you could also check out the property:
mouseChildren and do something like parent.mouseChildren = false;

Greetz Erik


On 1/25/08, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> oh, I found a solution. I have to do a parent.mouseEnabled = false,
> too, because parent is the parent of the video as well as the sprite.
> That's it! Oh, this saves my day! :-)
> Your suggestion would become my next attempt, Glen. I am glad, I now
> don't have to do that.
>
> Matthias
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Catching an error from a component

2008-02-02 Thread EECOLOR
I am not sure how it is possible that the item has been removed from the
display list. I however take your word for it :) Since you can not put a try
/ catch block (or check) around error area the solutions are limited.

My first thought was to extend the component and override the
thumbReleaseHandler, this method is however most likely private and thus can
not be overridden. You could however try this:

scrollbar.addEventListener(MouseEvent.MOUSE_UP, _listener, false, 1);

function _listener(e:MouseEvent):void
{
   //check if the scrollbar is part of the display list
   if (!scrollbar.stage)
   {
  //It is not in the display list, stop the event from being dispatched
to the default dispatcher
  e.stopImmediatePropagation();
   };
};

In the above code you add a listener that has a higher priority than the
internal listener of the scrollbar. Within the listener you check if the
scrollbar has still has a stage reference (which means it is still part of
the display list).
If it has not, you tell the event dispatcher to stop dispatching the event.

Before you try this code I would urge you to check the setup of your
application as it (usually) should be avoidable to have this error in the
first place.


Greetz Erik


On 1/29/08, Helmut Granda <[EMAIL PROTECTED]> wrote:
>
> I have a scroll component that sometimes is deleted from the display list
> while the user is holding the scroll bar and I get this error:
>
> TypeError: Error #1009: Cannot access a property or method of a null
> object
> reference.
> at fl.controls::ScrollBar/fl.controls:ScrollBar::thumbReleaseHandler()
>
> We know this error is fired since the scroll component is non-existent by
> the time the user releases the scroll bar...I am trying to catch it but
> not
> sure how should I catch this type of error since this is fired from within
> the component...
>
> I have tried the following:
>
> sp.addEventListener(MouseEvent.MOUSE_UP, catchError);
> sp.addEventListener(MouseEvent.MOUSE_LEAVE, catchError);
>
> and so forth... I am still trying but some suggestions would be great.
>
> Thanks,
> Helmut
> _
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Bundle swf's on server for transport to client

2008-02-02 Thread EECOLOR
With AS2 this indeed seems
tricky. With AS3 you could just zip the stuff, unzip within your Flash
application and load the bytes. Your best guess is a tool like swfmill
that has
the ability to
create swf's on the server. I only know of a library in java that has
the ability to generate swf's (javaswf).

If the content you are loading in is created within flash you might be able
to convert it to actionscript drawings (think lineTo and beginFill, etc).
This allows you to convert those commands to a text or xml file and run them
in your main application.


Greetz Erik


On 1/30/08, Gert-Jan van der Wel <[EMAIL PROTECTED]> wrote:
>
> Hi list,
>
> I'm working on the Flash app of
> Floorplanner and
> we are having some problems with the loading of all the swf's. The Flash
> app
> (AS2) consists of 1 main app that loads several forms (the windows you
> see,
> like the library). The library holds a lot of furniture elements, which
> are
> separate swf's that are loaded one by one.
>
>
> When someone creates a floor plan and adds furniture to it, it's not
> strange
> that the design holds more than 50 furniture
> elements.
> Though all elements are small swf files, it takes a lot of time to handle
> all resource requests on our server. So my question is: is there a
> technique
> that makes it possible to (dynamically) bundle a set of swf's on the
> server
> and transport it to the client?
>
> Right now I'm testing with swfmill and it looks promising, but it seems a
> little buggy...
>
>
> I hope someone can help me out and point me in the right direction.
>
> Cheers,
> Gert-Jan
> ___
> 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] Event Handling in ActionScript 3

2008-02-02 Thread EECOLOR
>just can't think of one now.

The most common case where you do not extend the EventDispatcher is when you
need to extend the Proxy class in order to catch dynamic method and property
calls. In that case
you need to extend a class that does not extend EventDispatcher itself
you can do something like this:

public class Test extends Proxy implements IEventDispatcher
{
   private var _eventDispatcher:EventDispatcher;

   public function Test()
   {
  _eventDispatcher = new EventDispatcher(this);
   };

   public function dispatchEvent(event:Event):Boolean
   {
  return _eventDispatcher.dispatchEvent(event);
   };

  public function addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean =
false):void
   {
  return _eventDispatcher.addEventListener(type, listener, useCapture,
priority, useWeakReference):void
   };

   ...

};


Greetz Erik


On 1/29/08, Guybrush Threepwood <[EMAIL PROTECTED]> wrote:
>
> Thank you again!
> I can't think of a reason not to extend EventDispatcher. I think most
> classes in AS3 seem to be a subclass of it.
> I'm sure there must be cases where you can't just extend EventDispatcher.
> I
> just can't think of one now.
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Delegate question...

2008-02-02 Thread EECOLOR
class fly.Delegate extends Object
{
   static function create(obj:Object, func:Function):Function
   {
  var returnFunction = function()
  {
 var self:Function = arguments.callee;
 var target_obj:Object = self.target_obj;
 var func:Function = self.func;
 var userArguments_array:Array = self.userArguments_array;
 return func.apply(target_obj, arguments.concat
(userArguments_array));
  };

  returnFunction.target_obj = obj;
  returnFunction.func = func;
  returnFunction.userArguments_array = arguments.splice(2);
  return returnFunction;
   }
};



Greetz Erik


On 2/2/08, Muzak <[EMAIL PROTECTED]> wrote:
>
> You don't and should never have to.
> Create a custom button (MovieClip+Class) that dispatches an event (e.g.
> "release"), rather than using a generic Button/MovieClip
> symbol.
> So instead of:
>
> someMC.onRelease = Delegate.create(_level0, doSomething);
>
> you'd then use:
>
> function doSomething(o:Object):Void {
> trace(o.target);
> }
> someMC.addEventListener("release", Delegate.create(this,
> doSomething));
>
> regards,
> Muzak
>
> - Original Message -
> From: "[p e r c e p t i c o n]" <[EMAIL PROTECTED]>
> To: "Flash Coders List" 
> Sent: Saturday, February 02, 2008 1:02 AM
> Subject: [Flashcoders] Delegate question...
>
>
> > Howdy,
> > Quick question...How can I pass vars if i'm using delegates for
> handlers
> > I have it set up like so...
> >
> >
> > someMC.onRelease = Delegate.create(_level0, doSomething);
> >
> > what i want to be able to do is know which instance of someMC actually
> > called it...
> >
> > thanks
> >
> > p
>
> ___
> 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] AS3 Sound = wtf

2007-09-13 Thread EECOLOR
Maybe this is a project you would like to check out?

http://code.google.com/p/popforge/


Greetz Erik



On 9/13/07, Andreas Rønning <[EMAIL PROTECTED]> wrote:
>
> I didn't mean hacking was wrong by any stretch, but i am not a "hacker". I
> simply don't have the time / budget to get in-depth on that level. Imagine
> what these hacker types (Andrè Michelle in particular) could do if the API
> natively supported the things they now hack to do? I don't really think the
> things Michelle does is "special" in terms of audio programming, but it IS
> special in a Flash context because of how limited the API is. It's a moan
> about how truly awesome Flash audio could've been with some direct way to
> affect audio and an orderly way to manage it i suppose?
>
> I'll write up a feature request myself. Good to hear more people want the
> same :)
>
> - A
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Google Maps or Yahoo maps

2007-09-13 Thread EECOLOR
A few weeks ago I had to create some map application in Flex 2 aswell. I
went out and started looking for a solution and came across a Flash Player 9
application that could connect with all types of map services including
google. But the source for that application was not available anymore
(apparently ordered by google or something).

I tried to figure it out myself by going over the JavaScript files. This
however would have taken ages as it's quite a complex process that google
uses. You can not just get the images directly, you need to send
somesort of header I guess.


Eventualy I used Yahoo, dug through the scripts and figured out how to load
the images.

I did not come across the G_map component in my search though, I'm not quite
sure how it works but my guess is that you could find out. However this is
on the google API's Terms of Use:

Your use of this photographic imagery is limited to displaying it to end
users within the Service itself, and in the same manner, form, format, and
appearance as it is provided by the Service. You may not, nor may you allow
others to, copy, distribute, display, alter, or otherwise use, this
photographic imagery except as it is provided to you through the Service.


This also the reason that I stopped persuing the better images of Google
maps.


Greetz Erik


On 9/13/07, Cédric PASCAL <[EMAIL PROTECTED]> wrote:
>
> But my problem would be now to combine AS2 file in flex.
>
> In fact i dont understand why no solution for Flex and AS3 exist :(
> Its strange
>
> Thanks
> I will do my best !
>
> PS : :) I will promise you French wine for someone who can find a solution
> !
> lol Ruse Cédric I 'am !
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [FlashCoders] AS3 TextFields with filters - game performance?

2007-09-13 Thread EECOLOR
I do not know what the performance inpact is of TextFields with
filters. If the performance it too great you could take a snapshot
of the text using a BitmapData instance. Then draw that BitmapData to
a Shape or Bitmap and apply the filters there.

As I said, I dont know about the difference in performance, but you could
try it :)


Greetz Erik

On 9/13/07, Dimitrios Bendilas <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I was wondering if any of you have any feedback to share concerning the
> extensive use
> of textfields with filters in games made with Flash 9 and ActionScript 3.
>
> We are developing a desktop "casual" game, let's say of the scale of Diner
> Dash (http://www.playfirst.com/game/dinerdashfloonthego).
> I am building a new Game Framework in AS3, Flash 9 and I was thinking of
> using
> the native TextField objects for displaying text of all kind.
>
> I want to use textfields with embeded fonts and various styles like Glow
> and DropShadow
> at will. The game will have text displayed on game panels, score, animated
> score,
> game messages and everything a middle-scale game contains.
>
> My major concern is performance, because of the use of filters. By the
> way, I want to use
> the filters so that I won't have to make a new Raster Font Engine in Flash
> (I've already done
> one for AS2.0)
>
> Any insight would be great.
>
> Thanks,
>
> Dimitrios
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] XML confusion

2007-09-12 Thread EECOLOR
The trace functions arguments are implemented as follows trace(...
arguments). Which means that all types of variables are accepted. Every type
of variable extends Object and with that every instance will have a toString
method. This is the method the trace function will call to display the
value.

The actual text from the documentation:

Displays expressions, or writes to log files, while debugging. A single
trace statement can support multiple arguments. If any argument in a trace
statement includes a data type other than a String, the trace function
invokes the associated toString() method for that data type. For example, if
the argument is a Boolean value the trace function invokes Boolean.toString()
and displays the return value.


Greetz Erik


On 9/10/07, ben gomez farrell <[EMAIL PROTECTED]> wrote:
>
> I don't think you're doing anything wrong, its just that the trace
> function only accepts strings as parameters.  So when you pass in your
> XML variable it would throw an error if you were using a more strict
> language like Actionscript 3 (at least I assume it throws an error in
> AS3, maybe it actually does the same thing).
> However, if you're using AS2, which is less strict, the trace function
> expects a string, so it'll try to convert your XML to a string, and it
> looks like its successful. It probably runs the XML.toString() method
> when it gets to the trace method.
> So you're not going to get anything from trace except for a converted
> string.  And it'll do the same thing in your scriptPath string, because
> its going to convert that XML variable to a string.
> If you want more control, you might try looping through your XML to
> create a more custom string, and then use that.
> ben
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] AS3 TextField.defaultTextFormat only works when focus is set to the TextField

2007-09-10 Thread EECOLOR
Hello,

this message is just for the archive. I have been fiddling with
defaultTextFormat for a few hours now and couldnt get it to work after
clicking on a button. Eventually I found out that in order for the
defaultTextFormat to be active, the TextField needs to have focus.


Greetz Erik
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Animate dynamic text

2007-09-08 Thread EECOLOR
There are two possible ways to achieve this:

1. Make sure the text is embedded. In order for text to have an alpha value
or rotation is needs to be embedded.
2. Make a 'screenshot' of the text using BitmapData.draw() and animate that.


Greetz Erik

> Hello
> > I want to know that there is any way of animating a text which we load
> > from
> > an external file .txt and then animate this text. Like we do with static
> > text which is inside the .fla.
> > Please help if any ideas.
> > Thanx
> > chand
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Copy and paste a movieClip?

2007-09-08 Thread EECOLOR
Yes in AS3 you can move DisplayObjects to other parents without problems.
One thing to note is that you need to remove it from the current display
list before you add it to the other.

Something like this:

parent1.removeChild(theClip);
parent2.addChild(theClip);


Greetz Erik


On 9/6/07, T. Michael Keesey <[EMAIL PROTECTED]> wrote:
>
> On 9/6/07, Mendelsohn, Michael <[EMAIL PROTECTED]> wrote:
> > Just as I suspected, Julian.  Thanks for your reply.  Doesn't this
> > feature exist in AS3?  (I have no experience with it yet.)
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] #SharedObject not so shared

2007-09-08 Thread EECOLOR
I remember asking the same question years ago. The answer was something like
this:

SharedObject.getRemote("my_so", "rtmp:/./..", "/");

I am not completely sure and do not have time to test it. As I forgot my
mailing list password I couldnt search the archives... And next to that, I'm
not sure if it still works in the current players.


Greetz Erik


On 9/8/07, Troy Gardner <[EMAIL PROTECTED]> wrote:
>
> We are running into a baffelling behavior using SharedObject.
>
> We have a a few Desktop Flash applications: One is a main application, the
> other an update utility for the main app. They use a Flash Cookie to find
> each
> other, as the main app could be installed anywhere (USB, C).   The apps
> are
> based in Director using the Flash8 Xtra.
>
> Say we start with a completely empty SharedObjects  folder
>
> Running the main app sets a cookie into a folder like
>
> Flash Player\#SharedObjects\BFYLPV7P\localhost\02000.sol
>
> via a call like
>
> var so : SharedObject = SharedObject.getLocal ("02000", "/");
>
> where "/" should see the root of the Flash Cookies.
>
> then say Pandora (or any other flash based website using cookies) runs it
> generates a new sandbox
>
> Flash Player\#SharedObjects\2S7GJDMQ\pandora.com
>
> and then all future read requests are against that new '2S7GJDMQ' folder
> instead of the "BFYLPV7P" folder, and then neither the app or the updater,
> can
> see the old shared local object folder anymore. Which in the case of it
> containing lots of persistent configuration data, is the equivalent of
> clearing
> the Browser cache and forgetting everything.
>
> Trying to understand how it's created, I can delete the contents of the
> shared
> Objects folder and then republish in the Flash IDE and get a new hash for
> the
> folder every time so it seems to be either random or time based. It's not
> as
> far as I can tell the behaviour documented, it's certainly not behaving as
> I
> would expect.
>
> Anybody have any ideas?
>
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com