0
Answered

Closing Sub-Wire (from "Call Sub-Wire Tutorial")

WriterRyan 7 years ago updated by icahill (Administrator) 7 years ago 4
I've been following along fairly well with the tutorials so far, but I hit a roadblock with the tutorial for calling a sub-wire. Specifically, I can't get it to close the sub-wire. As far as I can tell, I followed the tutorial closely with the exception of putting some panels in my subwire so I could see where my button is. Can anyone please take a look at my code and help me figure out what the problem is?

Thanks!

Code in main.wire:
<wire>
<main>
<panel name="issue1" width="45%" height="100%" xpos="10%" ypos="2%">
<image name="cover" source="pg1.png" onclickup="launch-issue" _wire="issue1.wire" _wirename="Issue1"/>
<text name="title" width="266" height="60" color="#ffffff" font="helvetica" size="18" alignment="center" text="ISSUE #1" bottomof="cover"/>
</panel>
<include name="issue" alias="ISSUE" width="100%" height="100%" background="#000000" alpha="0"></include>
</main>
<actions>
<action name="launch-issue">
<load file="_wire" wirename="_wirename" target="ISSUE"/>
<alpha value="1" time=".5" target="ISSUE"/>
</action>
<action name="close-issue">
<sync>
<unload delay=".5"/>
<alpha value="0"/>
</sync>
</action>
</actions>
</wire>


Code in issue1.wire:
<wire>
<main>
<panel name="bg" alias="BG" width="100%" height="100%" background="#000000">
<panel name="button" alias="BUTTON" width="25%" height="25%" xpos="50%" ypos="50%" align="center" background="#ffffff" onclickup="close"></panel>
</panel>
</main>
<actions>
<action name="close">
<play action="close-issue" superwire="yes" target="../../"/>
</action>
</actions>
</wire>
Likely the issue lies in your target path in your close action within the issue1.wire. Try making your target "../../.."
Thanks for the quick response. However, I added that, and now clicking it gives me an error:

"The anim 'close-issue' does not exist."
+1
Oh I see. Let's go the other way. Make your target this: target="../.."
That did it! Thanks. Counting levels of separation on relative pathing is kinda tricky...