Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. /* I have a system where the application loads an external stylesheet and applies it to all display objects. One of the features of that stylesheet is a attribute comparison, eg [hover=true]. When a display object requests its stylesheet, it walks through all the defined styles, including those with an attribute comparison. I have to be able to check whether or not a (non-dynamic) object has a certain property and whether it matches the value defined in the style. This is where object.hasOwnProperty() comes in to play. AFAIK it's the only way of doing this without using a try/catch block. Code goes something like this: */
  2.  
  3. for(var key:String in _equals) {
  4. if(!component.hasOwnProperty(key) || component[id] != _equals[id]) {
  5. return false;
  6. }
  7. }
  8.  
  9. return true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement