By using 'this' keyword
Button.onRelease = function() {
controller.buttonPressed(this);
}
(or whatever it looks like with delegate to get the correct scope to call
controller)
The controller has now got a reference to the button that was pressed.
Another way would be to give the button a reference to the controller when
it's created - then it can call the controller directly...
So, in your view:
Button = timeline.attachMovie(...etc...);
Button.controller = getController();
Then in your button:
Button.onRelease = function() {
This.controller.buttonPressed(this);
}
T
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Roberto
Scordino
Sent: 13 December 2006 13:41
To: [email protected]
Subject: [Flashcoders] Re: MVC pattern problem
The button didn't need reference to differents model (there is just
one model) that was an error, now I have changed so now I pass just
one reference to the model to the _root an every button can get it.
How can I pass the reference to the button at the controller?
By now I get the reference using arguments.caller.target,
how can I pass it in from the view when I assign the onRelease
function?
Can you please give me an example because I didn't understand (my
fault)
thanks
_______________________________________________
[email protected]
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
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.18/584 - Release Date: 12/12/2006
23:17
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.18/584 - Release Date: 12/12/2006
23:17
_______________________________________________
[email protected]
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