Send loaded swf to a certain frame
I'm sure this has been answered here before, but I can't find
anything in Search.
I load an external .swf file into a Loader. There is a button
on the main timeline which is supposed to send the Loader's Child
to frame 4. This has to be a simple operation, but I'm stymied. Any
help would be greatly appreciated. Thanks!
Hey, thanks for the quick response. Do you think you could
expand on that a bit? I don't know how to reference the loaded
swf... is it something like
Loader.child.gotoAndStop(4)? Thanks again.
Similar Messages
-
HTML: How to start playing a swf at a certain frame?
Hi, is it possible to start a swf (test.swf) not in the beginning but at a certain frame (comparable to gotoAndPlay) in between the html-file?
... Or is there any other way to start a swf at a given frame? Thanks, UteHi Ned,
now I found the solution by myself:
on (release) {
var my_mcl:MovieClipLoader = new MovieClipLoader();
my_mcl.addListener(mclListener);
my_mcl.loadClip("ecomo.swf",30);
and in ecomo.fla:
level30.abatimoaktiv = true;
level30.kollektion.abatimobtn_inst.gotoAndStop(2);
_level30.gotoAndPlay("abatimo");
But one more question: what level ist he best one to choose?
Ute -
hello,
I am making a website for myself and am having an issue with loading an swf and commanding the swf to go to a certain frame. Bassically I have one page, that has 7 seperate small thumbnail images on it which are buttons, each is commanded to open an swf file labelled slideshow. The slideshow swf showcases the thumbnails seperatly in a much larger scale, then the user can look through the images using previous and next buttons.
this is the code i have so far:
on (release) {
loadMovie("meglarge.swf",target_f);
So each image or Button has this code on it. Then the movie "slideshow.swf" is loaded into the target destination "target_f"
Although each time you click on any button it starts directly on the first frame of the slideshow. Which is always the first pictue. I want the user to be able to click on any image on the main page and it will load that frame of the slideshow first, which can then be navigated to the other pictures using forward and back buttons.
I hope this makes sense, and i thank you in advance for the helpIn order to be able to control the loaded file you have to wait until it has fionished loading until you can command it to do anything. Using loadMovie does not support any ability to determine when the file has finished loading. You need to use the MoiveClipLoader class instead, where you can make use of the addListener method to detect when loading is complete. If you look up the MovieClipLoader.addListener method in the help documents there is an example there showing how to use it.
-
When time line reaches a certain frame load swf into movieclip.
Hi,
I need some help with some actionsscript. When the timeline reaches a certain frame, I want an swf to load into a movieclip in that particular frame. I need this to occur on level 1 as the root of the site is pre loader. Any help would be much appreciated. CheersIn that frame, on an actions layer, use either the loadMovie method or the MovieClipLoader.loadClip method to load the swf into the movieclip. There should be examples of using either in the help documents and via Google.
-
Load new swf & goto certain frame #
I have 4 swf files. each file has 4 or 5 frames in it. I have
a button inside swf1 and when clicked I want to go from swf1 to
swf3 or from 3 back to 1. That is no problem with unloadmovie() but
the problem I am having is that I need to go to a certain frame. So
when I go from swf1 - swf3 and within swf 3 I need to go to frame
3. That is where I'm having troubles. I can get the swf 3 to load
but I can't get it to go to frame 3. Any help would be great.
ThanksInsted of using container.loadMovie("whatever.swf"), use:
container.loadMovieF("whatever.swf",F); where F is the frame number
you want the movie to go to on load. Place the following code
before all of your other code:
MovieClip.prototype.loadMovieF = function(url, frame) {
var obj = {f:frame};
var my_mcl = new MovieClipLoader();
my_mcl.addListener(obj);
obj.onLoadInit = function(targ:MovieClip) {
targ.gotoAndStop(this.f);
my_mcl.loadClip(url, this);
}; -
How to load and unload more than one external swf files in different frames?
I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
ThanksLook into using the Loader class to load the swf files. If you want to have it happen in different frames then you can put the code into the different frames.
-
Loading An Edge composition at a certain frame
What I would like to do is to load my Edge composition at a certain frame.
I would like to tell the Edge composition where to stop at, within my html file.
This because I need to load the comp at a different position in the timeline, depending on the html page where I need to place it.
I was able to start playing the comp
<script type="application/javascript">
var comp;
AdobeEdge.bootstrapCallback(function(compId) {
// "comp" is now equivalent to the Stage's "sym" variable.
comp = AdobeEdge.getComposition(compId).getStage();
comp.play();
</script>
but I would actually want to tell the comp to play at a label.. something like
comp.play("label");
but thats not working...
I am not very familiar with js since I come from After Effects, so it would be nice if someone could provide an example or point another discussion where this problem was solved.
ThanksYou will not be able to play from a label on stage timeline from bootstrap callback as the timeline playback has not started.
A workaround is to store the label name you wish to play from in a global variable in bootstrap call back function and using that label to play from in the 0th second trigger
I know the explanation above is bit confusing,so i have attached a example here.
IN main.html i save the label(red) to play from in
AdobeEdge.playFrom = "red";
Than in the 0th second trigger read that label and play from there like
sym.play(AdobeEdge.playFrom);
Sample here playFmor.zip - Google Drive -
Can you tell when a loaded SWF has reached its final frame?
I used loadMovie to load an external SWF into the bottom-half
of a main "shell" swf. When that loaded SWF finishes playing (it's
just an animation), I need to populate a text field with the word
"DONE" . The text field resides on the _root, so I need some way to
know when the loaded SWF has reached its last frame...
This would obviously be easy if I had the .FLA of the loaded
SWF because I could just write the actionscript on the last frame
of that SWF to populate the _root textfield. Alas, I do not have
the source FLA of that loaded SWF, so I need some way to have the
main "shell" SWF/FLA know when that loaded SWF has reached its end.
Is this possible???
Thanks!!!DIY_Lobotomy,
> The reality of my situation is that there's a "menu" of
sorts that
> gets loaded into "contentClip". This "menu" has a bunch
of links.
So far, so good.
> When clicked, each link loads a DIFFERENT swf into
"contentClip".
> It is THOSE swfs that I need to note the end of.
That's still okay.
> So, there's actually more than one, and they're not
exactly being
> loaded directly from my main movie, since they're
actually loaded
> based on a link being clicked in the movie that is
currently loaded
> into "containerClip"
The concept is still the same, no matter what. No matter how
deep the
one-clip-loads-another chain goes, you have to keep taps on
each chain link.
When the final link has loaded, you'll be able to make your
object reference
to that movie clip. That movie clip -- because it's an
instance of the
MovieClip class -- will have the _currentframe and
_totalframes properties.
You'll just be checking *that* cliip's properties instead of
the one named
contentClip in my own example.
You can loop using onEnterFrame or, if you prefer, with
setInterva().
That doesn't much matter either, so long as you repeatedly
poll the deepest
clip to test its current frame against its last frame (this
all assumes that
the clip being tested is a linear animation whose end
corresponds to its
last frame; otherwise, you could check _currentframe against
any arbitrary
frame number).
> I hope that wasn't too confusing! Do you still have a
solution???
Not too confusing to understand, but it might be confusing
to route
through in practice. Not confusing, actually, but meticulous
... you'll
have to be careful with your pathing. Nested movie clips are
very much like
nested folders on your hard drive. Their instance names
relate to the
folder names.
Now, if that menu doesn't have an instance name you provided
-- or if
any fork along the path has an instance name you can't
control -- you can
still reference the nested movie clips. If you test your file
in the
Debugger panel, you'll see all the instances laid out in
hierarchical order.
You'll see that automatic instance names are provided
(something like
"instance1", "instance2", etc.).
David Stiller
Contributor, How to Cheat in Flash CS3
http://tinyurl.com/2cp6na
"Luck is the residue of good design." -
Is it possible to load an external swf at a specific frame?
Hey! I've got a flash file which acts as the main menu for a
program I'm developing. Everything works fine from the main menu
however when you click to return to the main menu the whole main
menu file reloads. Is it possible to use loadMovieNum( ) to go to a
specific frame within the main swf file? If not, is there a way to
do this?
Here's the button code I'm using now:
on (release) {
unloadMovieNum(0); //unloads the current movie so we can
reload the main menu
loadMovieNum("DemoMainMenu.swf", 0); //reloads the main menu
Thank you for whatever help you can provide! :)mcommini wrote:
> Hey! I've got a flash file which acts as the main menu
for a program I'm
> developing. Everything works fine from the main menu
however when you click to
> return to the main menu the whole main menu file
reloads. Is it possible to
> use loadMovieNum( ) to go to a specific frame within the
main swf file? If
> not, is there a way to do this?
First let me clarify one thing with you. Level zero is the
main level on the flash
player. By loading things in level zero you will remove
current content and replace
it with the new one. This is not a good idea because it works
like purge, clears the
player and from there on you can't maintain any functionality
unless you reload the
whole html document over again. Also, do not unload and load
in the same time in the
same level. Flash can hold single SWF per level, once you
load content, whatever previously
loaded will be automatically replaced, so just the loadMovie
action and you all set.
Good practice is to have the main level (zero) an empty base
and than load and unload
things in above levels, 1 and so on...
> Here's the button code I'm using now:
> on (release) {
> unloadMovieNum(0); //unloads the current movie so we can
reload the main menu
> loadMovieNum("DemoMainMenu.swf", 0); //reloads the main
menu
> }
>
In regard to the load and go to. Yes it is possible but no
matter what frame you want to
go to,you need to load the whole movie first. I will come
back to that in a second.
While you execute the loadMovie action, you can set up a
variable, for example:
loadMovieNum("file.swf", 1);
Variable="mcommini_01";
Than in the loaded movie you have preloader which makes sure
that the movie is loaded before
playing and once done loading, make it jump to frame which
has IF ELSE condition in some kind
of loop, using setInterval or Enterframe. That condition
checks for the variable value and based
on it proceed to particular frame.
That's why I told you not to clear level zero, if you set
variable and load movie in that level
in the same time, all the information will be gone and you
have totally no reference point to
get the variable from.
You could as well use shared object which is native form of
Flash's cookies. Write SOL file into
user drive temp folder, than read it from the other file and
go to frame based on the given value.
Best Regards
Urami
Beauty is in the eye of the beer holder...
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
Load swf into mc frame by frame
Hi, I have a movieclip to dynamically load swf's. Some of my
swf's are slideshows and contain jpgs that are quite large.
Therefore I do not want to wait till the end of a complete load to
show the swf. Say, if i want to show picture 3 (at frame 3), i'd
like to show it as soon as the frame is loaded. However, I also
need to rezie the swf to fit my mc's fixed size. Resize only works
after all bytes of the swf are loaded I believe.
How do I solve this problem?
TedCan you be more specific? I read at the MCLoader apis, but
still have no clue how to solve this problem. -
Get externallu loaded swf frame length?...
Hi all,
I need to know the frame length of a swf loaded via
loadMovie().
I want to stop the loaded swf playback before it reaches its
last frame. So I need to extract
(detect) the frame length of the swf, and call a function
when the swf reaches the second to last frame.
Is this possible?
PS: I am not fluent in AS, so please provide some kind of
code example if you can.
seb (@webtrans1.com)
high-end web design:
http://webtrans1.com
Sign-up for a free beta test of SiteLander, an ingenious
website-builder:
http://webtrans1.com/sitelander/
music:
http://myspace.com/popmodelberlinuse the _totalframes property of your target movieclip (or
_level). -
Trigger function when loaded swf finishes
I'm making a site that loads external swfs based on which
button is clicked. When the swf loads it plays an intro and then
stops at a certain point. My goal is that when you click another
button the current swf plays an outro before the next one loads.
The problem I'm having is making the outgoing movie trigger the
function that loads the next.
At first I tried just adding loadNextMovie(); to the last
frame of the loaded swf. But for some reason this causes the two
stops in the file from working so the thing just keeps looping. I
have no idea why adding this function call would prevent stop();
from working.
Is there another way to have the end of movie trigger the
function? Also, why doesn't adding loadNextMovie(); to the last
frame of the loaded swf work?Ok, sure. I have main.swf that loads external.swf. Main.swf
has a function that loads a different movie. Like this:
function loadMovie():void {
trace("movie loaded")
This function is to be called from external.swf by putting
this in the last frame:
stop();
loadMovie();
But when I actually put loadMovie(); into external.swf the
stop no longer works and it just loops. What am I doing wrong? Is
trying to put this function call in the external swf the correct
approach? -
Flushing loaded swfs from stage target mc?
Hi, I'm using buttons to send the playhead to frames in which swfs are then loaded into an otherwise blank movieclip called "stage_target_mc" ...how can I then flush out the previously loaded swf so only a newly loaded swf displays in "stage_target_mc"? For example, after clicking upon the 'about' button the 'about' swf loads...then if the 'concepts' button is clicked the 'concepts' swf loads -- but the previously loaded 'about' swf still plays...I would like to be able to flush the 'about' swf so only 'concepts' is display, in this example. Thanks!
code associated with buttons used to send playhead to frames "concepts" or "about":
about_btn.addEventListener(MouseEvent.CLICK, displayAbout);
function displayAbout(e:MouseEvent):void {
root.gotoAndStop("about");
concepts_btn.addEventListener(MouseEvent.CLICK, displayConcepts);
function displayConcepts(e:MouseEvent):void {
root.gotoAndStop("concepts");
code on frame called "concepts":
stage_target_loader.load(new URLRequest("swfs/stages/concepts.swf"));
MovieClip(root).stage_target_mc.addChild(stage_target_loader);
code on frame called "about":
stage_target_loader.load(new URLRequest("swfs/stages/about.swf"));
MovieClip(root).stage_target_mc.addChild(stage_target_loader);Before loading, try using the unloadAndStop() method of the Loader class if you are using a newr version of Flash
-
Please help - Problem with loading swf's (running very slowly)
Hi
I have posted this problem up in the last few days so I built a quick demo of my problem. Can somebody please download it and take a look at it and see what I'm doing wrong?
You can download it here at:
http://www.bounceworld.ie/download/Demo_Test.zip
The external swf's when loaded.....run very very slow; sometimes unresponsive as if there is a script running in the background. I'm using keyboard commands to navigate through the screens - eg:
on (keyPress "<Space>") {
gotoAndStop("scene02", "firstframeLabel");
Thank you for your help!!!!Hi
I'm trying to use Key Listeners to solve my problem.
I don't know much about key liseners so can somebody help me out.
I have the following on a keyframe yet it still wont jump to the certain frames when I press the relevent keys. Am I missing something?
stop();
KeyListener = new Object();
KeyListener.onKeyDown = function() {
if (Key.getAscii() == 38) { // UP key
gotoAndStop(89);}
if (Key.getAscii() == 40) { // DOWN key
gotoAndStop(91);}
if (Key.getAscii() == 37) // LEFT key
gotoAndStop(88);}
if (Key.getAscii() == 32) { // SPACEBAR key
loadMovie("application_01.swf", "container");} -
How to unload externally loaded swf which contains 3D Carousel?
Hello to all
I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at carousel_c_fla::MainTimeline/moveCarousel()
this error repeats over and over again slowing my swf movie.
So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
//Import TweenMax
import com.greensock.*;
//The path to the XML file (use your own here)
// old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
var xmlPath:String = "carousel-menu.xml";
//We'll store the loaded XML to this variable
var xml:XML;
//Create a loader and load the XML. Call the function "xmlLoaded" when done.
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);
//This function is called when the XML file is loaded
function xmlLoaded(e:Event):void {
//Make sure that we are not working with a null variable
if ((e.target as URLLoader) != null ) {
//Create a new XML object with the loaded XML data
xml = new XML(loader.data);
//Call the function that creates the menu
createMenu();
//We need to know how many items we have on the stage
var numberOfItems:uint = 0;
//This array will contain all the menu items
var menuItems:Array = new Array();
//Set the focal length
var focalLength:Number = 350;
//Set the vanishing point
var vanishingPointX:Number = stage.stageWidth / 2;
var vanishingPointY:Number = stage.stageHeight / 2;
//We calculate the angleSpeed in the ENTER_FRAME listener
var angleSpeed:Number = 0;
//Radius of the circle
var radius:Number = 128;
//This function creates the menu
function createMenu():void {
//Get the number of menu items we will have
numberOfItems = xml.items.item.length();
//Calculate the angle difference between the menu items (in radians)
var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
//We use a counter so we know how many menu items have been created
var count:uint = 0;
//Loop through all the <button></button> nodes in the XML
for each (var item:XML in xml.items.item) {
//Create a new menu item
var menuItem:MenuItem = new MenuItem();
//Calculate the starting angle for the menu item
var startingAngle:Number = angleDifference * count;
//Set a "currentAngle" attribute for the menu item
menuItem.currentAngle = startingAngle;
//Position the menu item
menuItem.xpos3D = 0;
menuItem.ypos3D = radius * Math.sin(startingAngle);
menuItem.zpos3D = radius * Math.cos(startingAngle);
//Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the menu item according to the scale ratio
menuItem.scaleX = menuItem.scaleY = scaleRatio;
//Position the menu item to the stage (from 3D to 2D coordinates)
menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
//Add a text to the menu item
menuItem.menuText.text = item.label;
//Add a "linkTo" variable for the URL
menuItem.linkTo = item.linkTo;
//We don't want the text field to catch mouse events
menuItem.mouseChildren = false;
//Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
//Add the menu item to the menu items array
menuItems.push(menuItem);
//Add the menu item to the stage
addChild(menuItem);
//Assign an initial alpha
menuItem.alpha = 0.3;
//Add some blur to the item
TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
//Update the count
count++;
//Add an ENTER_FRAME listener for the animation
addEventListener(Event.ENTER_FRAME, moveCarousel);
//This function is called in each frame
function moveCarousel(e:Event):void {
//Calculate the angle speed according to mouseY position
angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
//Loop through the menu items
for (var i:uint = 0; i < menuItems.length; i++) {
//Store the menu item to a local variable
var menuItem:MenuItem = menuItems[i] as MenuItem;
//Update the current angle of the item
menuItem.currentAngle += angleSpeed;
//Calculate a scale ratio
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the item according to the scale ratio
menuItem.scaleX=menuItem.scaleY=scaleRatio;
//Set new 3D coordinates
menuItem.xpos3D=0;
menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
//Update the item's coordinates.
menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
//Call the function that sorts the items so they overlap each other correctly
sortZ();
//This function sorts the items so they overlap each other correctly
function sortZ():void {
//Sort the array so that the item which has the highest
//z position (= furthest away) is first in the array
menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
//Set new child indexes for the item
for (var i:uint = 0; i < menuItems.length; i++) {
setChildIndex(menuItems[i], i);
//This function is called when a mouse is over an item
function mouseOverItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
//This function is called when a mouse is out of an item
function mouseOutItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
//This function is called when an item is clicked
function itemClicked(e:Event):void {
//Navigate to the URL that's assigned to the menu item
var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
navigateToURL(urlRequest);Hi Ned thanks for the reply,
Ok so I have a button in my main movie that loads the external swf
stop();
var my_loader:Loader = new Loader();
var my_btn:Button = new Button();
var my_pb:ProgressBar = new ProgressBar();
my_pb.source = my_loader.contentLoaderInfo;
my_btn.addEventListener(MouseEvent.CLICK,startLoading);
function startLoading(e:MouseEvent):void{
my_loader.load(new URLRequest("carousel.swf"));
addChild(my_pb);
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
function finishloading(e:Event):void{
addChild(my_loader);
my_loader.addEventListener("killMe",
killLoadedClip);
removeChild(my_pb);
function killLoadedClip(e:Event):void {
my_loader.removeEventListener("killMe",
killLoadedClip);
my_loader.unloadAndStop();
removeChild(my_loader);
Then I have a button in my loaded swf that closes the loader
This is spread over 2 frames
Frame1
function closeIt(e:MouseEvent):void {
parent.dispatchEvent(newEvent("killMe"));
Frame 2
back_btn.addEventListener(MouseEvent.CLICK, closeIt);
Frame 2 also holds all the code for the carousel
Thanks for your time and help in advance people ; )
Maybe you are looking for
-
My Logic Pro 9 crashes after OS update to 10.6.8, Logic Pro 9 crashes after OS update to 10.6.8, Logic Pro 9 crashes after OS update to 10.6.8 This happens when I play songs, the songs were done in Logic and everything was ok until I ran an update. T
-
Help with Java Program. Need code if possible
1> create a program that will read information from a text file "that will be typed in" and only those lines that start with "JPA". Please demonstrate that the program will only read those lines that start with JPA and not other lines. You can create
-
Ipod not working after Europe trip
I have a 20GB Ipod with click wheel, purchased in March 2005. I spent two months in Germany this summer. During that time I charged my Ipod several times using a plug adapter. I know that a voltage converter is not needed for the Ipod, as the charger
-
Elements 9 Organizer unresponsive after power outage
Hi I hope somebody can help me asap about this. I was editing photos in Elements Editor, the photos open in Organizer. The power went out, computer shut off. When power came back on, Editor works fine. But Organizer loads but as soon as I click on a
-
I need help. I just purchased a HP Envy 23 running Windows 8. It came with Adobe Premiere and Elements 11 already installed. I own Lightroom 3, which I installed very quickly and easily. I own CS4 Web Premium with the serial number at hand. I inse