Actor behavior questions

Captain Stoudt

  • Posts: 41
So I have two actors in my scene. One overlaps the other, but both have effects when clicked. The one on top is a text box that I want to disappear after it is clicked. This isn't an issue, however when I click on that actor where it overlaps the second actor, both events are triggered. How can I disable the second actor until after the first actor is clicked?

merrak

  • *
  • Posts: 1898
A simple approach would be to have a global boolean (as a global attribute) set when the first actor is active. In the code for the second actor, check for this boolean.

This approach can get a bit messy if you have a lot of enabled/disabled actors. In that case, you may need something more sophisticated (maintaining a list of active/disabled actors, etc.).

Captain Stoudt

  • Posts: 41
It's only the one scene so I'll work with what you've suggested tomorrow and post back on here if I get it working. Thanks for the suggestion.

Captain Stoudt

  • Posts: 41
Okay, I've fixed the issue using the code I've posted. Now I"m getting this error. Any idea what it is?

SecurityError: Error #2148: SWF file file:///Users/BrandonStoudt/stencylworks/games-generated/Dungeon Delvin/Export/flash/bin/Dungeon Delvin.swf cannot access local resource . Only local-with-filesystem and trusted local SWF files may access local resources.
   at global/flash.net::navigateToURL()
   at flash::Lib$/getURL()[/Applications/Stencyl/plaf/haxe/std/flash/Lib.hx:57]
   at openfl::Lib$/getURL()[/Applications/Stencyl/plaf/haxe/lib/openfl/openfl/openfl/Lib.hx:101]
   at com.stencyl.behavior::Script$/openURLInBrowser()[/Applications/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/behavior/Script.hx:3668]
   at MethodInfo-7807()[Source/scripts/ActorEvents_112.hx:93]
   at com.stencyl.models::Actor/innerUpdate()[/Applications/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/models/Actor.hx:1496]
   at com.stencyl::Engine/update()[/Applications/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2492]
   at com.stencyl::Engine/postUpdate()[/Applications/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2618]
   at com.stencyl::Engine/onUpdate()[/Applications/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2611]

Captain Stoudt

  • Posts: 41
I should add that everything works as it should. I just get this error and I can either hit "Continue" or "Dismiss All". After hitting either, everything proceeds as planned. This happens when I click on the newly created actor that links to a webpage. (I'm using this to create a portal for users to donate since I plan to release my game for free)

LenseOnLife

  • *
  • Posts: 127
Hi,

It looks like you have a flash settings problem.

try this link

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

Best of luck

Oliver