Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-06-2006, 03:28 PM   #11
Incrue
the ever-living
 
Incrue's Avatar
 
Join Date: Jan 2006
Location: inside this plane
Posts: 113
Send a message via MSN to Incrue
Default

So, now one more question...
what is binding?
Here
http://labs.macromedia.com/wiki/inde...:Learning_Tips
they say:
"Binding should always be done to strongly-typed data items, not to properties of type Object.
The lack of type safety with type Object can result in accidental coding mistakes, so the compiler will flag this as a warning. Binding to a property of something of type Object, such as selectedItem.name, will cause a warning; you need to use strongly-typed data items and cast, as in EmployeeInfo(selectedItem).name."
Incrue is offline   Reply With Quote
Old 04-06-2006, 03:31 PM   #12
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,858
Default

a binding is a way to make your view or model update automatically. the flex framework allows you to write certain metaTags and the compiler then generates the code for you to take care of what happens in terms of the stuff getting updated.
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 04-07-2006, 11:45 AM   #13
Incrue
the ever-living
 
Incrue's Avatar
 
Join Date: Jan 2006
Location: inside this plane
Posts: 113
Send a message via MSN to Incrue
Default

I dont know if i should create a new thread cos those are not just two questions anymore
1 public and private are now public and internal, rigth?

2 What is override?

3 What is Dereferencing?
Incrue is offline   Reply With Quote
Old 04-07-2006, 12:50 PM   #14
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,858
Default

there is public , protected, private and internal.
public is easy to understand.
protected works like this: if i have an instance of the class a protected method acts like a private method aka i can't call it from the outside. however if i subclass that class, i can change the bahevaiour of the function by overriding it, but then i have to use the override keyword to signify that i am overriding existing behaviour. and i can call that protected from subclasses
private works the same in terms of its visibility from the outside, but i cannot override the methods in subclasses nor call it.
internal's scope means its availivble to all classes in the same package and suclasses.


i think you should get what the override keyword does from what i have said already.
dereferencing means deleting a variable that holds a reference to an object. its not like an oficial term, but search garbage collector and refrence counting.
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 04-07-2006, 10:43 PM   #15
webninja
Registered User
 
Join Date: Mar 2006
Location: Rhode Island
Posts: 51
Default

Keep in mind that binding is done at compile time. That means something like this won't work:

var x:uint;

x = {boundProperty} * 3;

No error or warning will be generated, but you'll get the value of {boundProperty} without it being multiplyed by 3.
webninja is offline   Reply With Quote
Old 04-08-2006, 02:47 PM   #16
Incrue
the ever-living
 
Incrue's Avatar
 
Join Date: Jan 2006
Location: inside this plane
Posts: 113
Send a message via MSN to Incrue
Default

Quote:
Originally Posted by hangalot
there is public , protected, private and internal.
public is easy to understand.
protected works like this: if i have an instance of the class a protected method acts like a private method aka i can't call it from the outside. however if i subclass that class, i can change the bahevaiour of the function by overriding it, but then i have to use the override keyword to signify that i am overriding existing behaviour. and i can call that protected from subclasses
private works the same in terms of its visibility from the outside, but i cannot override the methods in subclasses nor call it.
internal's scope means its availivble to all classes in the same package and suclasses.
Inst best OOP practice to use get and set?Like function getSomething and set like setSomething?And when making a class defining wich methods and properties others should have acess?So i dont understand this stuff to acess things who weren't designed to be acessible
So, its sounds like a useless things to learn, cos if i will have acess to internal stuff only with get and set i can just make only those methods public and all the rest of the other things private, or internal,or protected
Incrue is offline   Reply With Quote
Old 04-08-2006, 05:56 PM   #17
webninja
Registered User
 
Join Date: Mar 2006
Location: Rhode Island
Posts: 51
Default

In any OO design, it is very good practice to isolate access to the internals of a class so that only members of that class or classes derrived from it have access.

Getters and setters are basic practce and in AS3 there is even a dedicated syntax for it which aids binding.

One of the goals of OO design is to promote code resuability. This is accomplished by coding classes that do a specific bit of work. You start out with a classes that accomplish very generic tasks and then subclass the class a few times adding specificity. you'll find that you can then reuse the base classes. If you go accessing the varibals from all over your code you won't be able to reuse it. Have a look at the AS3 class lib docs and you'll see just how often they use the same classes near the root of the tree.

When you have a bug, you'll have a lot of trouble figuring out what can change what. As your conventional non-OO project grows, fixing bugs will become more complex. When every varible is global and you have functions that access stuff from all over your source, it does not take long before you lose track of what's happening. Any little change can impact the whole project, which leads to more bugs.
webninja is offline   Reply With Quote
Old 04-09-2006, 09:48 AM   #18
Incrue
the ever-living
 
Incrue's Avatar
 
Join Date: Jan 2006
Location: inside this plane
Posts: 113
Send a message via MSN to Incrue
Default

Ok
What i didnt understand is:When making the class you design what everyone everywhere will have acess, and these will work with get and set, right till here...
So when comes to internal, all other classes in the package can acess the thing, but arent they acessing things who are not suposed to be acessible?
So that this is not best oop practice?
Now override, i supose override is:i take some method, change what he does but keep his name
I may be wrong, but i understand that i should use -protected- only if i intend to make some subclass override some method of my class
But again, isnt this against the good oop practice?Cos someone is acessing thing who were not designed to be acessible?
And when i am going to need to do this?
Incrue is offline   Reply With Quote
Old 04-09-2006, 11:48 AM   #19
Tink
Addict
 
Tink's Avatar
 
Join Date: Nov 2001
Location: London
Posts: 2,128
Default

No this is better OOP than what you can do with public and private alone.

Lets say you have a method that ONLY other classes in the same package can access. You can now limit the access to what is required using internal. This is much better than making it public to everything.

This works the same with protected. If you subclass a class and you need to access it methods in your subclasses you can mark the method protected. This limits the access to subclasses only. Without it, you again would have to make it public. Therefore you can now be stricter, which is better.
Quote:
i should use -protected- only if i intend to make some subclass override some method of my class
That is incorrect. You use protected for any method or variable that you want to access from a subclass.

override is used when you want to alter a method that is inherited from you superclass. It must return tha same type and take exactly the same parameters as the original method.

You may also be interested in 'final'. specifying a method as final means that it cannot be overriden. so if you had a superclass with a method you want to be able to access from a subclass, but you don't want your subclass to be able to override it, you specify the original method as final.

Code:
// This cannot be overriden, but can be accessed by subclasses.
protected final function methodName():void
{
// Actions here.
}
Tink is offline   Reply With Quote
Old 04-09-2006, 12:11 PM   #20
Incrue
the ever-living
 
Incrue's Avatar
 
Join Date: Jan 2006
Location: inside this plane
Posts: 113
Send a message via MSN to Incrue
Default

Ok, thanks everyone for the help
Incrue is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Randomly Loading Questions from XML for Quiz. Dave At ADC ActionScript 2.0 0 12-14-2005 01:49 PM
Newbie questions.. timemachine ActionScript 1.0 (and below) 5 05-21-2005 07:59 PM
help on simple questions infernojericho Gaming and Game Development 0 05-08-2005 06:52 PM
[Q] Do we need those forums??? CyanBlue General Chat 59 07-27-2004 11:13 AM
A couple more newbie PHP questions simontheak Server-Side Scripting 13 06-09-2003 04:59 PM


All times are GMT. The time now is 10:24 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.