Skip to main content
Inspiring
November 28, 2007
Answered

Imported SWF actionscript not working in _root movie...

  • November 28, 2007
  • 3 replies
  • 1108 views
Hello.

I will tell you below what I want to accomplish, then I'll tell you what I have done (that didn't work). I'm hoping that someone here can tell me where I went wrong, and also how to fix it and pull off what I'm trying to do. Thanks!...

WHAT I WANT TO DO:
I want to have a Captivate SWF loaded into the bottom half of a main Flash "shell" SWF, and then when the Captivate SWF is done playing, a text field on the main "shell" SWF puts the word "DONE!" in it.

WHAT I HAVE DONE (that didn't work):
I have a Flash SWF that loads a Captivate3 SWF in its bottom half (that works fine). The top half of the main Flash movie has a dynamic text field on it called "doneText_txt".

I then made another SWF that is just 10x10px and all that is on it is ActionScript on the first frame that says:

_root.doneText_txt.text = "DONE!";

I then went on the last slide/frame of my Captivate project (in Captivate) and did an "Insert-->Animation" to insert that small 10x10 SWF onto that final slide.

When I load that main "shell" and then the Captivate project loads at the bottom and finishes playing, nothing is displayed in the "doneText_txt" text box.

THINGS I NOTICED:
When I imported the SWF into Captivate, it was transparent (didn't show up). I adjusted the transparency on it (in Captivate) to both 0% and 100%, and it still didn't show up. I thought that it may be just because it had nothing on it (just the default white background), so I went back into Flash and re-exported the 10x10 SWF after filling it with black. I re-imported it into Captivate, and still it didn't show up. Like, I figured you'd see a black square on the slide. It was on the timeline, and I could move it around on the slide, but it was just a clear transparent box. This made me think that the reason the "DONE!" text wasn't getting passed was because there was a problem with the SWF even being on the slide in the first place.

Any ideas???? Or, if there's another way to pull off what I'm trying to do, that would be fine with me as well. Thanks!!!
    This topic has been closed for replies.
    Correct answer DIY_Lobotomy
    I FOUND A SOLUTION!!!!

    Instead of using:

    _root.doneText_txt.text = "DONE!";

    I added a bunch more "_root"s to it like this:

    _root._root._root._root._root._root._root.doneText_txt.text = "DONE!";

    And it worked!!!

    I guess that the SWFs that you load into Captivate actually (behind the scenes) get loaded into Captivate swfs themselves, so there's a bunch of other _root levels that need to be reached. To be safe, just throw a bunch in there!

    3 replies

    Participating Frequently
    November 28, 2007
    I'm not a Flash developer, so I really can't help you.

    However, my understanding is that _root is the indeed the top layer (or bottom, depending on how you like to think of things). However, if you're using a skin, I believe that becomes _root and your actual movie sits on a child layer.

    There's also the possibility that Captivate may put inserted animations on their own layer, hence my suggestion to have the animation "declare" itself via a global object reference rather than try to hard-code a path to the object through the various layers.
    Captiv8r
    Legend
    November 28, 2007
    Hi all

    I'm not a Flash developer either, nor did I stay at a Holiday Inn Express last night, so I can't claim to be one.

    However, I do dabble in JavaScript a bit. I know that JavaScript sometimes has issues with single quotes and double. I'm wondering if maybe you just need to change alert.show("It works") to alert.show('It works').

    I'm thinking that it's not going to be quite as simple as that, but might be worth trying. Stranger things have happened with me.

    Cheers... Rick
    DIY_LobotomyAuthorCorrect answer
    Inspiring
    November 29, 2007
    I FOUND A SOLUTION!!!!

    Instead of using:

    _root.doneText_txt.text = "DONE!";

    I added a bunch more "_root"s to it like this:

    _root._root._root._root._root._root._root.doneText_txt.text = "DONE!";

    And it worked!!!

    I guess that the SWFs that you load into Captivate actually (behind the scenes) get loaded into Captivate swfs themselves, so there's a bunch of other _root levels that need to be reached. To be safe, just throw a bunch in there!

    Participating Frequently
    November 28, 2007
    I don't think inserted objects are placed on _root, so I wouldn't expect it to work.

    Perhaps you need to have your object identify itself via a global variable, then have your code reference the object via the variable?
    Inspiring
    November 28, 2007
    quote:

    Originally posted by: jbradley88
    I don't think inserted objects are placed on _root, so I wouldn't expect it to work.

    But isn't "_root" just the top-most object? So, if I'm loading the Captivate project from my main Flash SWF, then that main Flash SWF is the "_root" no matter what, right? Or am I wrong about that???


    quote:

    Originally posted by: jbradley88
    Perhaps you need to have your object identify itself via a global variable, then have your code reference the object via the variable?

    Can you explain in more detail how to do this? I REALLY need to get this working, but I'm just at a total loss!

    Thanks!!!

    Inspiring
    November 28, 2007
    I have the same problem..
    My imported swf only has an alert.show("It works") actionscript.
    And that doesn't even work
    Inspiring
    November 28, 2007
    quote:

    Originally posted by: BurTech
    I have the same problem..
    My imported swf only has an alert.show("It works") actionscript.
    And that doesn't even work


    Have you found any solution to it yet???
    Inspiring
    November 28, 2007
    Edit:
    Just was informed that swf with Flash components dont work when imported into captivate.
    So the alert component wont work for me.
    I have to figure out some other work around.
    ----------------------------------------------------------------------------------------------------
    not yet.
    Im not using _root or _parent
    Im just making a basic call
    alert.show("It works")
    The alert works in flash player.
    but imported into captivate it does nothing..