Welcome, Guest
  • Author Topic: Using attachMovie within an SWC  (Read 7932 times)

    RocketRonny

    • Server what's that
    • *
    • Posts: 10
      • View Profile
    Using attachMovie within an SWC
    « on: 07/12/07, 11:20 »
    Hi there,

    I've created a component that dynamically attaches MCs from it's library, this works as expected when running the component SWF itself. When I export the component as an SWC and install it within a container SWF, the attachMovie call fails.

    It appears that the attachMovie call is accessing the library of the main SWF which does not include the assets of the SWF within the installed SWC. Is it possible to merge the assets of the component with the main library, I would have thought that installing the SWC would achieve this anyway  ???

    Thanks in advance,
    Ronny.

    RocketRonny

    • Server what's that
    • *
    • Posts: 10
      • View Profile
    Re: Using attachMovie within an SWC
    « Reply #1 on: 07/12/07, 12:14 »
    It appears that if the MC is on the stage within the component SWF, then the attachMovie call works. The "Export in first frame" linkage property is completely ignored, presumably because installed components don't initialize in the same way as the main SWF. Has anyone had any similar experiences with this ?

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Using attachMovie within an SWC
    « Reply #2 on: 07/13/07, 03:00 »
    I you use components in a loaded MC, you have to have these components in your base MC in the library.

    In the meantime we can call this "well documented" ;)
    happy flashing
    8)
    Ronald

    RocketRonny

    • Server what's that
    • *
    • Posts: 10
      • View Profile
    Re: Using attachMovie within an SWC
    « Reply #3 on: 07/13/07, 05:19 »
    I'm not actually using a loaded MC, I've just created a component that I'm installing into my main FLA, everything is contained within a single SWF. The component class calls attachMovie on MCs in its own library but this fails when the component is running within the main SWF, the component can't access anything within its own library.

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Using attachMovie within an SWC
    « Reply #4 on: 07/13/07, 06:43 »
    if the attached movie has components, they have to be in the lib anyway.
    If you imported the fla into anotherone, they are not in the right libpath.
    Just make sure all used components be in the root of the library.

    Further be aware of the depth problem with V2 components.
    « Last Edit: 07/13/07, 06:45 by Ronald Wernecke »
    happy flashing
    8)
    Ronald

    RocketRonny

    • Server what's that
    • *
    • Posts: 10
      • View Profile
    Re: Using attachMovie within an SWC
    « Reply #5 on: 07/13/07, 08:23 »
    The attached movie doesn't contain any components. I've knocked up a simplified example of what I'm trying to achieve to clear things up a little :

    The following SWF contains my component and a smiley face MovieClip. The initMC function within my component class attaches the smiley face to the component, this works fine :

    http://www.gimme5games.com/test_component/component.swf

    I then create an SWC file using this SWF and install it into the following SWF :

    http://www.gimme5games.com/test_component/container.swf

    As you can see, the smiley face has not been attached. Only the black rectangle appears, even though I have "Export in first frame" checked on the smiley face MovieClip.

    The component AS file and sample FLAs are also available here :

    http://www.gimme5games.com/test_component/test_component.zip

    Thanks,
    Ronny.

    RocketRonny

    • Server what's that
    • *
    • Posts: 10
      • View Profile
    Re: Using attachMovie within an SWC
    « Reply #6 on: 07/19/07, 06:53 »
    Ok, I seem to have scared everyone away, I'll try a different approach. Has anyone had any experience embedding sounds within components and playing them via AS (attachSound and start) ? When I run my component SWF on its own this works, when the component is installed in another FLA it doesn't. Help !

    Andresss

    • Systems Administrator
    • *****
    • Posts: 738
    • check me out at www.asb-labs.com/blog
      • View Profile
      • asb-labs
      • Email
    Re: Using attachMovie within an SWC
    « Reply #7 on: 07/19/07, 13:25 »
    hey hi RocketRonny! well that may be due to flash now works more like classes than the way we were used to...

    cheers!!!
    halemos de flash en espaņol!....wondering about crazy flash experiments?

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Using attachMovie within an SWC
    « Reply #8 on: 07/19/07, 14:06 »
    it very much depends on how and where you inserted the sound.
    happy flashing
    8)
    Ronald

    RocketRonny

    • Server what's that
    • *
    • Posts: 10
      • View Profile
    Re: Using attachMovie within an SWC
    « Reply #9 on: 07/20/07, 05:17 »
    I have a MovieClip with a single frame and have dragged the sound "snd" from the library into this frame. I've dumped this MovieClip on the first frame of the component MovieClip and have the following code attached to a button in frame 4 of the component MovieClip.

    var snd:Sound = new Sound();
    snd.attachSound("snd");
    snd.start(0, 1);

    Sound plays fine when I run the standalone SWF but doesn't play when I use the component within another SWF.