Just a quick check, as I'm more used to Director's inheritance model than
Flash's!

I have an object A which extends B, which in turn extends MovieClip

Object B has a method 'fGetElementAt' which returns a movieclip
In A, I want to extend this by adding some extra code on top:

(leaving out declarations etc in the following:) 

function fGetElementAt(tX, tY) {
        tRet = super.fGetElementAt(tX, tY)
        if (tRet == this) {
                doSomethingElse()
        }
        return tRet
}

and the superclass version, just for sake of argument (obviously it's more
complicated than this):

function fGetElementAt (tX, tY) {
        return this
}


My question: will the 'this' parameter refer to the same object in the
superclass as it does in object A? 

Just to show where I'm coming from, to those who know Lingo, here's an
equivalent:

on mGetElementAt me, tX, tY
        tRet = ancestor.mGetElementAt(tX, tY)
        if (tRet = me) then
                doSomethingElse
        end if
end

and the ancestor version (again for the sake of argument)

on mGetElementAt me, tX, tY
        return me
end

In this version, the if statement in the subclass would fail because the
variable 'me' refers to different objects in the two cases. In Lingo, I can
avoid this happening by using

        tRet = callAncestor(#mGetElementAt, me, tX, tY)

instead. So is super.function more like ancestor.function or more like
callAncestor(function)?

Hope that makes some sense!

Danny

_______________________________________________
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

Reply via email to