+1
Résolu

Super out of 2 layers of includes

jakelisby il y a 12 ans mis à jour il y a 12 ans 12
Can you superwire out of 2 includes to perform an action in the main.wire?

For example I have main.wire that includes subwire1.wire and that includes subwire2.wire. I want to instigate an action from subwire2.wire and have it trigger in main.wire.
You can easily do this by adding an action into your subwire that uses the play tag.


<action name="tomain">
<play action="actioninmain" superwire="yes" target="../.." />
</action>
Just remember that it should play an action that exists in your main.wire. The target is targeting the main.wire.
I'm not quite sure I follow. Can you clarify what each of the '../' sections are meant to represent?

Right now I am having trouble just getting it to find an action from subwire1.wire to main.wire, even though I can do a superwire from subwire2.wire to subwire1.wire. Not quite sure why it won't let me superwire into the main.wire at all...
This particular target uses relative pathing. Since you can't assign an Alias to a wire, this represents the following:

../..

The first ../ is the subwire root level (where the block level tags live)
the second .. is the main.wire root level.

The superwire="yes" tells the engine to move past the subwire root level and continue to path the main.wire.
Hmm, ok... so let's talk about moving between subwire1.wire to main.wire...

Here's my code:

When I call the action, it's performing (confirmed by other events occurring within the same action) but it's saying the action "swapTab" is not found.

Here's my code in main.wire:
Dang, sorry about that...

Here's the code in subwire1.wire:
 

<action name="swapTab">
<assign property="object:MENUTABIMG.source" value="graphics/menuTab_lowpro.png"/>
</action>


And here's the code from main.wire:


<action name="launch-posts">
<!-- <play action="swapTab" superwire="yes" target="../.." /> -->
<load file="_wire" wirename="_wirename" target="POSTVIEW" />
<alpha value="1" time=".5" target="POSTVIEW" />
</action>
I think I understand what you are trying to do.

Unfortunately, you can use the play tag to play main.wire actions from subwires, just not the other way around.

subwire1.wire:


<action name="swapTab">
<assign property="object:MENUTABIMG.source" value="graphics/menuTab_lowpro.png"/>
<play action="launch-posts" superwire="yes" target="../.." />
</action>


main.wire:


<action name="launch-posts">
<load file="_wire" wirename="_wirename" target="POSTVIEW" />
<alpha value="1" time=".5" target="POSTVIEW" />
</action>
Wait, I labeled those backwards... The first is the main.wire and second is subwire1.wire...

Man, apparently it's amateur hour right now...
Ok then disregard my last comment.

Depending on your setup, you may just try updating the target to ../../.. and try again. Sometimes there is an extra layer that I miss.
So the action target is based off the object the action is triggered from. So you need to come out of that object (../) and then move up to the root and onto main.wire. you might need a few extra paths depending on where your pager is.
That was the issue, I just wasn't supering out enough... Strange, well it's all good now. Thanks for your help!