I want to add movieclips which are instances of a certain class to an array (only add movie clips which are instances of BLAH). I can't find any property which refers to the movieclip's class. Can anyone help?
Use is operator:
if( mc is BLAH){
// here you are
}
From docs:
Evaluates whether an object is compatible with a specific data type,
class, or interface
Related
I want to define two classes whose members are nodes and they are the extent of several links.
In the first class, one of these links have a type Highway, while in the second class none of them is a type Highway.
I can make the first class using SWRL but the second one is not possible since there seems to be no negation for such an expression.
could I define them using General Class axioms?
something like:
Class1: Node and (in_extent_of some Arc and min one Arc is Highway)
Class2: Node and (in_extent_of some Arc and Arc not Highway)
I'm using an array for objects that are performing a hitTest on another object, called Chest. Basically I want to drag the array objects into the chest, and when a certain object is in the chest certain functions will run. So to go about it I want to assign each object a "touching" property that is false by default, and true if the array object is touching/"in" the chest, but I'm not sure how.
I'm new to action/javascript and I've heard you can pretty much assign whatever properties you want to any object, but I'm not sure how to go about that and how the properties would be managed.
To add to this, how could I keep track of how many objects in the array are touching the chest?
Any explanations with or without example code would be greatly appreciated!
Create a class of the object you want to hittest.(for example, Test)
Add checkHit property or some thing like that.
class Test extends MovieClip
{
public var checkHit:Boolean=false;
}
In Root class,
push every object into an array.
testArray.push(new Test());
Now,
You can check hit in EnterFrame event with a loop.
for(var i:int=0;i<testArray.length;i++)
{
if(testArray[i].hitTestObject(chest))
{
testArray[i].checkhit=true;
/// prefrom your code.
}
}
If you want to check no. of objects hitting chest. you can use a global variable.
for(var i:int=0;i<testArray.length;i++)
{
if(testArray[i].hitTestObject(chest))
{
testArray[i].checkhit=true;
hitCount++;
/// prefrom your code.
}
}
My class Posts has a column that is a pointer to another class called Styles. Each post must be associated to a Style object as a rule of thumb.
My problem: I can't get only the posts that are associated to one or more styles.
My object selectedStyles, that is an array of PFObjects that already contains the style objects I would like to use to match the query. So populating the selectedStyles is not an issue, but how to use it to produce my query is.
What I am doing at the moment is:
override func queryForTable() -> PFQuery {
var query = PFQuery(className: "Posts")
query.whereKey("bellongsToStyle", containsAllObjectsInArray: [selectedStyles])
query.orderByDescending("createdAt")
return query
If I could translate the whereKey method in plain english I would say:
...contains - ANY OF THE - PFObjectsInArray [selectedStyles]
I am not so sure if that is possible... any ideas?!
I think I am too late for this but you can just add
[IncludeKey:"bellongsToStyle"]
when you are querying in your 'Posts' class
don't need to run any extra query for that
here's a small reference
http://blog.parse.com/announcements/queries-for-relational-data/
I have a SportsCentre class which contains an array of Employee objects.
Which is the right way to show that an attribute's data type is an array of objects?
I have found two different versions online:
the first one uses the ArrayList<> keyword:
SportsCentre
- listOfRegistered : ArrayList<Employee>
getRegisteredList() : ArrayList<Employee>
the second one uses square brackets []:
SportsCentre
- listOfRegistered : Employee[0..*]
getRegisteredList() : Employee[0..*]
Both are correct, but the second one, when multiplicity is set to more than one, is used more naturally, and it is not necessary to define the collection class as it is shown in the first picture of your example.
Simply said, multiplicity defines how many instances of a specific type can be stored by attribute. This set of instances can be ordered, or duplicates in it may be allowed. Parameters of multiplicity elements have an impact on the type of collection which should be used, Set, Vector, Array, etc.
But, if you need precise info about this issue, read UML Superstructure. Search for Property and Multiplicity Element. here is the UML website
Can I filter by.repeater('object in array') so it returns just objects with a specific value in Protractor?
E.g. something like
var filteredElements = element.all(by.repeater('object in array')).column('object.type').value('car'));
Is something like this possible without creating additional loops (and without creating new promises)?
These elements doesn't have any unique identifier? If they have you can do a cssSelector searching for that specific identifier (id, class or any other attributes..)
If they don't have ny unique identifier, the best way to do that is change you FE application to add the class "car" to each element that you want to have, and then, have a selector that retrieves all the element with class "car".