The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • Flash Newbie
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 Flash Newbie

  • dbrandon Author 
    • 2684 
    • 0 
    • 4 
    [AS3] Imported swf won't stop looping

    Last reply Aug 05 2008, 11:28 AM

    by

    Posted: Jul 29 2008, 08:25 PM

    by dbrandon

     

I have a swf file which i have imported into another by adding it to the library and then giving it a linkage class to be imported at runtime.

The child swf file contains code to stop it’s timeline at frame 1, then wait for a given amount of time, and then carry on. This works fine when run stand alone, however when run from within the parent, it just loops, disregarding the stop() function at frame 1.

Any ideas why this is ?

The code im using to stop the child swf is simply

this.stop(); 

And the code im using to import the child swf at runtime (within the parent one) is

var childSwf:Child = new Child();
addChild(childSwf); 


Any help would be greatly appreciated.

  4 REPLIES
 
djnorthyy
1  
djnorthyy

Have you tried loading the SWF using URLRequest()? This is the method I have always used, and have never come across this sort of problem.

Look it up in here: http://www.iheartactionscript.com/loading-an-external-swf-in-as3/

Hope it works smilie
Harry.

  • 04 August 2008 01:01 PM
  •  
dbrandon Author 
2  
dbrandon

Thank you for your suggestion. I had considered doing it this way (as you are right, it solves the problem i was having), but i need to create multiple instances of the loaded swf, which i dont believe is possible using a URLRequest ?

  • 05 August 2008 11:10 AM
  •  
ServerSide
3  
ServerSide

If it works fine when run on its own and breaks when loaded into parent then it sounds like a scope problem.  Have you tried dropping ‘this.’ and just use ‘stop();’ on frame 1 of the child swf?

  • 05 August 2008 11:20 AM
  •  
Darth-Awesome
4  
Darth-Awesome

Hey D, you can in fact make as many instances as you want.

lets say you have finished loading your swf into a loader call movieLoader.  Don’t add movieLoader as a child in stead do this.

var clip1:MoiveClip = movieLoader.content;
var 
clip2:MoiveClip = movieLoader.content;
var 
clip3:MoiveClip = movieLoader.content;
var 
clip4:MoiveClip = movieLoader.content;
var 
clip5:MoiveClip = movieLoader.content;

addChild(clip1);
addChild(clip2);
addChild(clip3);
addChild(clip4);
addChild(clip4); 


if you are doing it dynamically use an array to store the refrences to the clips, and there you go, multiple instances of a loaded swf.

  • 05 August 2008 11:28 AM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 775  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,724  Assets
  • Profiles 282,659  Members
  • Topics 93,762  Topics
  • Blog 4  Blog
  • Facebook 1,680  Facebook
  • Twitter 1,165  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 04, 2012 - 19:50:24