Re: [Flashcoders] [as2] problem with super class on Tweener callback

2008-03-04 Thread Wagner Amaral
Hello, Cory!

That is a nice one, I believe it would work for now!
Oh, the wonders AS2 forces you to do...

Thanks!
-- 
Wagner Amaral
Agência Ginga - Brazil
www.agenciaginga.com.br



On Tue, Mar 4, 2008 at 3:52 PM, Cory Petosky <[EMAIL PROTECTED]>
wrote:

> I don't have a solution, but I have an arguably less ugly workaround
> that I've used in similar cases.
>
> public class Superclass {
>public function load():Void {
>   __load();
>}
>
>protected function __load():Void {
>// "Base class" functionality here
>}
> }
>
> public class Subclass extends Superclass {
>public function load():Void {
>Tweener.addTween(this, {onComplete: __load});
> }
> }
>
> On 3/4/08, Wagner Amaral <[EMAIL PROTECTED]> wrote:
> > Hey there Zeh!
> >
> >  On Tue, Mar 4, 2008 at 12:18 PM, Zeh Fernando <[EMAIL PROTECTED]>
> >  wrote:
> >
> >
> >  >
> >  > Hm.. that's a good question. It runs functions inside of the instance
> >  > using .apply, but if you pass the super.load without wrapping it, I'm
> >  > sure exactly how the function reference is handled by actionscript.
> >  >
> >
> >
> > Yeah, I've looked at Tweener's code, even tried to tweak a little bit to
> see
> >  if I could get through it, then I realized it's not Tweener's fault.
> >  By issuing a:
> >  trace(tScope);
> >  on line 754, right before:
> >  tTweening.onComplete.apply(tScope, tTweening.onCompleteParams);
> >  it traces my current instance correctly.
> >
> >
> >
> >  >
> >  > Anyway, have you tried this instead?
> >  >
> >  > public function load():Void {
> >  >var obj:Object = new Object({
> >  >   _y: 200,
> >  >   time: 1,
> >  >onComplete: function() { super.load(); }
> >  >});
> >  >Tweener.addTween(this, obj);
> >  > }
> >  >
> >
> >
> > Yes, I tried that. Just tried again right now to make sure I wasn't
> missing
> >  anything ;)
> >  Still, no success...
> >
> >  I've just pasted the code from the superclass inside the onComplete
> handler
> >  (it's just a event dispatch anyway, works for now), but I really hate
> myself
> >  for doing this, specially because this is a refactoring of some old
> crappy
> >  code, and it's supposed to be made the right way.
> >  Anyway, still trying to come up with something. (Boy, I really wish the
> boss
> >  would let me use AS3 already, I'm sure these things wouldn't happen.
> AS2
> >  really isn't made to serious programming)
> >
> >  Thanks for the help so far, Zeh! Valeu!
> >
> >
> >  --
> >
> > Wagner Amaral
> >  Agência Ginga - Brazil
> >  www.agenciaginga.com.br
> >  ___
> >
> > Flashcoders mailing list
> >  Flashcoders@chattyfig.figleaf.com
> >  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
> --
> Cory Petosky : Lead Developer : PUNY
> 1618 Central Ave NE Suite 130
> Minneapolis, MN 55413
> Office: 612.216.3924
> Mobile: 240.422.9652
> Fax: 612.605.9216
> http://www.punyentertainment.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] [as2] problem with super class on Tweener callback

2008-03-04 Thread Cory Petosky
I don't have a solution, but I have an arguably less ugly workaround
that I've used in similar cases.

public class Superclass {
public function load():Void {
   __load();
}

protected function __load():Void {
// "Base class" functionality here
}
}

public class Subclass extends Superclass {
public function load():Void {
Tweener.addTween(this, {onComplete: __load});
}
}

On 3/4/08, Wagner Amaral <[EMAIL PROTECTED]> wrote:
> Hey there Zeh!
>
>  On Tue, Mar 4, 2008 at 12:18 PM, Zeh Fernando <[EMAIL PROTECTED]>
>  wrote:
>
>
>  >
>  > Hm.. that's a good question. It runs functions inside of the instance
>  > using .apply, but if you pass the super.load without wrapping it, I'm
>  > sure exactly how the function reference is handled by actionscript.
>  >
>
>
> Yeah, I've looked at Tweener's code, even tried to tweak a little bit to see
>  if I could get through it, then I realized it's not Tweener's fault.
>  By issuing a:
>  trace(tScope);
>  on line 754, right before:
>  tTweening.onComplete.apply(tScope, tTweening.onCompleteParams);
>  it traces my current instance correctly.
>
>
>
>  >
>  > Anyway, have you tried this instead?
>  >
>  > public function load():Void {
>  >var obj:Object = new Object({
>  >   _y: 200,
>  >   time: 1,
>  >onComplete: function() { super.load(); }
>  >});
>  >Tweener.addTween(this, obj);
>  > }
>  >
>
>
> Yes, I tried that. Just tried again right now to make sure I wasn't missing
>  anything ;)
>  Still, no success...
>
>  I've just pasted the code from the superclass inside the onComplete handler
>  (it's just a event dispatch anyway, works for now), but I really hate myself
>  for doing this, specially because this is a refactoring of some old crappy
>  code, and it's supposed to be made the right way.
>  Anyway, still trying to come up with something. (Boy, I really wish the boss
>  would let me use AS3 already, I'm sure these things wouldn't happen. AS2
>  really isn't made to serious programming)
>
>  Thanks for the help so far, Zeh! Valeu!
>
>
>  --
>
> Wagner Amaral
>  Agência Ginga - Brazil
>  www.agenciaginga.com.br
>  ___
>
> Flashcoders mailing list
>  Flashcoders@chattyfig.figleaf.com
>  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>


-- 
Cory Petosky : Lead Developer : PUNY
1618 Central Ave NE Suite 130
Minneapolis, MN 55413
Office: 612.216.3924
Mobile: 240.422.9652
Fax: 612.605.9216
http://www.punyentertainment.com

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


Re: [Flashcoders] [as2] problem with super class on Tweener callback

2008-03-04 Thread Wagner Amaral
Hey there Zeh!

On Tue, Mar 4, 2008 at 12:18 PM, Zeh Fernando <[EMAIL PROTECTED]>
wrote:

>
> Hm.. that's a good question. It runs functions inside of the instance
> using .apply, but if you pass the super.load without wrapping it, I'm
> sure exactly how the function reference is handled by actionscript.
>

Yeah, I've looked at Tweener's code, even tried to tweak a little bit to see
if I could get through it, then I realized it's not Tweener's fault.
By issuing a:
trace(tScope);
on line 754, right before:
tTweening.onComplete.apply(tScope, tTweening.onCompleteParams);
it traces my current instance correctly.


>
> Anyway, have you tried this instead?
>
> public function load():Void {
>var obj:Object = new Object({
>   _y: 200,
>   time: 1,
>onComplete: function() { super.load(); }
>});
>Tweener.addTween(this, obj);
> }
>

Yes, I tried that. Just tried again right now to make sure I wasn't missing
anything ;)
Still, no success...

I've just pasted the code from the superclass inside the onComplete handler
(it's just a event dispatch anyway, works for now), but I really hate myself
for doing this, specially because this is a refactoring of some old crappy
code, and it's supposed to be made the right way.
Anyway, still trying to come up with something. (Boy, I really wish the boss
would let me use AS3 already, I'm sure these things wouldn't happen. AS2
really isn't made to serious programming)

Thanks for the help so far, Zeh! Valeu!

--
Wagner Amaral
Agência Ginga - Brazil
www.agenciaginga.com.br
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] [as2] problem with super class on Tweener callback

2008-03-04 Thread Zeh Fernando

Hello there!
(...)
Well, what that does, in the same situation as above, is that when Tweener
is done, that very own load() function is called again.
I've tried using Delegate, delegating to himself, to the superclass, nothing
did it.
I've also tried creating a local function that just calls super.load() and
delegating to that, but no luck either.

My guess at the moment is that it's a side-effect to the "weird" AS2
implementation of static classes.
However I'm curious. Am I doing something completely wrong and not noticing
it? Is my implementation flawed?
Or there is a way to work that around?


Hm.. that's a good question. It runs functions inside of the instance 
using .apply, but if you pass the super.load without wrapping it, I'm 
sure exactly how the function reference is handled by actionscript.


Anyway, have you tried this instead?

public function load():Void {
   var obj:Object = new Object({
  _y: 200,
  time: 1,
  onComplete: function() { super.load(); }
   });
   Tweener.addTween(this, obj);
}

I believe your overall implementation is fine.

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


[Flashcoders] [as2] problem with super class on Tweener callback

2008-03-04 Thread Wagner Amaral
Hello there!

Here's the deal: I have the following class hierarchy

MovieClip  // adobe
- BasicMovieClip  // as2lib
-- GenericMovieClip
--- EventMulticasterMovieClip
 GenericSection
- DropdownSection  // abstract class, private constructor
-- *Several classes extending DropdownSection

That GenericSection is part of a section handling. It has basically two
functions: load() and unload(), both public, and they basically dispatch an
event, so my section handler can act properly.
Ok, so I have several "sections" who behave almost the same, so I'm writing
generic code in DropdownSection, so I can generalize it more cleanly.

Here comes the code:

When I have this on DropdownSection:

public function load():Void
{
   super.load();
}

public function unload():Void
{
   super.unload();
}

(these are not necessarily needed, but just to clarify)
then everything works perfectly, when my section handler calls load() and
unload() on any of the classes that extends DropdownSection.

However, when I code something like this:

public function load():Void
{
   var obj:Object = new Object({
  _y: 200,
  time: 1,
  onComplete: super.load
   });
   Tweener.addTween(this, obj);
}


(and the equivalent for the unload() function)
* Tweener is Zeh Fernando's tween class - http://code.google.com/p/tweener/

Well, what that does, in the same situation as above, is that when Tweener
is done, that very own load() function is called again.
I've tried using Delegate, delegating to himself, to the superclass, nothing
did it.
I've also tried creating a local function that just calls super.load() and
delegating to that, but no luck either.

My guess at the moment is that it's a side-effect to the "weird" AS2
implementation of static classes.

However I'm curious. Am I doing something completely wrong and not noticing
it? Is my implementation flawed?
Or there is a way to work that around?



Thank you very much for your time!
-- 
Wagner Amaral
Agência Ginga - Brazil
www.agenciaginga.com.br
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders