Is there a way to export an image as a SWF in CS4 and have this SWF use code from main timeline?

Posted on 2011-04-26
Last Modified: 2012-05-11

I have created a series of standalone frames within a flash file, each one of which I need to export out as a SWF file.

These standalone frames do contain movieclips some of which animate, some are static and some need to be instructed to animate to demonstrate state changes etc.

In order to animate the movieclip I added code on the main timeline instructing the stage instance to gotoAndPlay from a specific frame within the movieclip. Running the animation normally, the code behaves itself...

However when you export the specific frame as an image, then save it as a SWF it ignores the code from the master timeline.

Is there a way round this please?

I experienced this same problem years ago and had to use Director to help fudge a solution, this is no longer an option.

My ideas to solve it include:
1) internalizing the code, putting it inside the mc so it hopefully picks up - early tests suggest this will work, however it is untidy and inflexible

2) use seperate movieclips for each state I need - a pain

3) write to experts and see if they have a good idea - excellent idea :)

To clarify... For example if I was to export frame 5 of my flash file as an image and save it as a SWF, that SWF would ignore the code on the master timeline. The code on the master timeline at frame 5 might be to tell a movieclip of a thermometer to play (showing increase in temperature).

The compiled SWF would show a thermometer movieclip but it would not play it.

movieclips that have animation within them play fine, and will stop if they have an internal timeline command asking them to do so.

Any help, greatly appreciated.
Question by:arasburn
    LVL 29

    Accepted Solution

    LVL 1

    Author Comment

    Hi dgofman,

    Thanks for getting back to me. Unfortunately, I don't think this is quite what I need as the assets are all internal. I appreciate I could bring them into a blank movie with AS3 and as such would have much more control, but the main idea is to have the images in the timeline as a fast layout environment. Also I am in a team of three and whilst I am happy with AS2, none of us are particularly AS3 savvy and due to the project requirements we need to use AS3; the other two don't code at all.

    I've had an idea to add switch code or conditional statements (if) to the internal timelines of the affected movieclips with the idea that if I can get them to read the parent frame label I can then instruct them to do what they should be doing on that frame.

    I have done a bit of a test and exporting as a SWF image will allow for basic code to be executed within a movieclip - the test was to populate a text field with dummy text passed as a string; it worked.

    Do you know how I can access the current root frame label from inside an MC please? I have looked online and tried FrameLabel but I am getting errors. I'm sure it is possible but I just can't quite get it.

    i used an example from here:

    and on the main timeline using his examples I can to a certain extent wrangle my way round the labels, however as soon as I dropped into an MC (and played with currentFrame etc) the whole thing broke down.

    Any help greatly appreciated, thank you for the link, it looks really good in its own right and will undoubtedly help me improve my poor AS3 skills.

    LVL 1

    Assisted Solution

    After exhaustive tests, I am now confident that 'Export Image' > 'SWF' will not process code in the same way as a full publish; which is what you would expect. All work arounds I have tried, including internalizing code within timeline (bad practice) still fall short.

    Awarding half points to dgofman for getting back to me, his solution certainly would work, but it is not a solution I can use for this project.
    LVL 1

    Assisted Solution

    I am trying to award half points to dgofman for his help, and close the question. Not an easy/obvious process
    LVL 1

    Author Closing Comment

    Not appropriate for my project / not what I was trying to achieve but an excellent idea
    LVL 29

    Expert Comment

    I cannot understand why your team using AS2 :)

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now