Does anyone know if it's possible to create an instance of an object in order to duplicate it to add different events to it ?
For example if there's a button that gets used in different places, but depending on where that button is in the flow it would have a different action assigned to it...
Any pointers would be greatly appreciated.
U-Kyung Kim - Any idea how I may be able to achieve this... I tried something like this:
addVehicleButtons = ["vehicle1", "vehicle2", "vehicle3"]for addVehicleButton in addVehicleButtons addVehicle = new Layer width: 331 height: 423 #y: 332 image: "images/addVehicleButton1.png" parent: VehiclesContainer addVehicleButtons.push(addVehicleButton) addVehicleButton.x = 329 addVehicleButton.x = 740 addVehicleButton.x = 740
I typically use a for loop like you've done to create multiple layers. The layer.copy() function may help as well. You can then add events to the layers as you would like. Hope this helps! :)