Going to a loaded frame in a loaded swf
I've been successful to load a external swf using the loader.
Lesson_mc is a movieclip I have on stage that I am loading the
external swf. I have some masking that is there, that is why the
movieclip. myLoader is a Load object. I can find the swf loaded
using the debugger and see the currentLabel and Frame but when I
try to get the information it sends a DisplayObject error. I have a
Menu in the Main Window that controld the navigation. Getting to
the frame on the first click works but trying to go to a frame
within the same sef does not. Any thoughts?
myRequest = new URLRequest("overview09.swf");
myLoader = new Loader();
myLoader.load(myRequest);
addChild(myLoader);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
LessonLoad);
function LessonLoad(evt:Event):void{
trace("Lesson Loaded = ");
Lesson_mc.addChild(myLoader);
}//end function
OTTOMH:
don't you need the INIT event instead of the COMPLETE event?
socalfish wrote:
> I've been successful to load a external swf using the
loader. Lesson_mc is a
> movieclip I have on stage that I am loading the external
swf. I have some
> masking that is there, that is why the movieclip.
myLoader is a Load object. I
> can find the swf loaded using the debugger and see the
currentLabel and Frame
> but when I try to get the information it sends a
DisplayObject error. I have a
> Menu in the Main Window that controld the navigation.
Getting to the frame on
> the first click works but trying to go to a frame within
the same sef does not.
> Any thoughts?
>
> myRequest = new URLRequest("overview09.swf");
> myLoader = new Loader();
> myLoader.load(myRequest);
> addChild(myLoader);
>
>
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
LessonLoad);
> function LessonLoad(evt:Event):void{
> trace("Lesson Loaded = ");
> Lesson_mc.addChild(myLoader);
> }//end function
>
>
Similar Messages
-
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." -
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. -
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 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. -
My Ipad is stuck in an "infinate loop" it goes from the "loading" (white apple) to the openning screen. I can slide to the passcode entery screen but it will not take the passcode. ( when I type it it does not recognize on the screen)
I suggest try getting it back to your stock iOS and forget about jailbreaking.
http://support.apple.com/kb/TS1538
Try a manual install (using DFU Mode), as outlined in the link below.
Basic troubleshooting steps
17" 2.2GHz i7 Quad-Core MacBook Pro 8G RAM 750G HD + OCZ Vertex 3 SSD Boot HD
Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
In Memory of Steve Jobs -
HELP!!!!! Z10 starts up but goes into a load up loop
When you say flash it what do you mean????
Hi Everyone, I NEED HELP!!!!! my Z10 didn't load my text messages this morning so i restarted it and now it goes into the loading screen gets to 100% and freezes every now and then restarts its self only to do the same again, i plugged it into my laptop and now that won't recognise it!!! any ideas on how to fix it??????
-
CLICK in main timeline goes to where click is designated in loaded swf?
Seems doable, but having trouble grasping the concept...
I have a loaded swf slide show, within that slideshow, I have assigned "next" and "prev" buttons to advance and back up my slide shows via frame labels ("oneIn") for instance... here is an example:
btn_next.addEventListener (MouseEvent.CLICK, nextClick);
function nextClick (e:MouseEvent):void{
this.gotoAndPlay ("twoIn");
I would like this function to run when I click a hit state on the main timeline above it. So, how would I trigger the above function from a click on the hit state on the main timeline?
To help, here is my code for the mouse over function using the hit state that refers to the external buttons:
pNextH.addEventListener (MouseEvent.MOUSE_OVER, nextOver);
function nextOver (e:MouseEvent):void{
var mc:MovieClip = MovieClip(imageLoader.content);
mc.btn_next.gotoAndPlay ("nextOver");Actually, just as I am confused a bit... would I need no function descriptor?
Just this line? As opposed to:
pNextH.addEventListener(MouseEvent.CLICK, nextClick);
function nextClick (e:MouseEvent):void{
var mc:MovieClip = MovieClip(imageLoader.content);
(mc.content).nextClick
I know that is wrong, but do i need a function def for the code you gave me? Or just the one line?
pNextH.addEventListener(MouseEvent.CLICK,MovieClip(yourloader.content).nextClick ); -
FF6 wont connect to websites. Shows 'connecting...'or green circle going round. Loads some or none of page. remains like this indefinitely.
Have removed & re-entered FF in Norton360 f/wall & uninstalled then downloaded FF6 again to no avail. IE/Chrome OKJust an update... A rep contacted me and we did a screen share. They were convinced that I wasn't full of <insert proper word here>. They promised to get back to me in a few days, and now? A few months later? Nothing.
Still no files. Still no correction... Still no nothing from Adobe.
The person I spoke to was kind, saying he'd make sure I got CC for free for a while...
Still though, no follow up.
Adobe, are you going to correct this or just let your customer suffer at your mistakes? -
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). -
Going to a specific frame in a clip on another page
As may be self evident I am not an expert..... Is it possible
for a button (or series of buttons) on one page which, when
clicked, opens another html page with an embedded swf movie and
then goes to a specific frame in that movie ???
If that makes senseno - simply put, if the html page/SWF and frame isn't loaded
when button is pressed - there isn't a
way because it doesn't exist yet.
Chris Georgenes / mudbubble.com / keyframer.com / Adobe
Community Expert
LindnArden wrote:
> As may be self evident I am not an expert..... Is it
possible for a button (or
> series of buttons) on one page which, when clicked,
opens another html page
> with an embedded swf movie and then goes to a specific
frame in that movie ???
>
> If that makes sense
> -
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 ; ) -
TypeError: Error #1009 (loaded SWF)
I'm pulling out my hair on this one!
I'm just starting a site (full-Flash site) using CS3 and AS3.
I'm pretty much accustom to the new AS3 changes. I built a rough
structure to make sure the way I wanted to set the site up would
work (loading in external SWFs, etc.). The tests worked.
Now, I'm going in to make some things real, and I'm getting
this error as soon as an external SWF loads in:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at test_fla::MainTimeline/test_fla::frame2()
I've tried narrowing it down, couldn't find the exact culprit
(had to remove every ounce of ActionScript before it started to
function again). So I started to rebuild that movie entirely --
cleared out the Library and deleted every layer. Didn't work.
Couldn't even add a stop(); action in Frame 1.
Then I started completely fresh File > New, rebuilt again.
I tested after every single change. I finally built it up to the
point where I first tested the original, and it worked. So, then I
added a couple more things tested again, and got the error again.
Ahh, so I removed EXACTLY what I had just added. Tested again. SAME
ERROR -- now it won't go away no matter what I remove!
Crazier yet is that I can still load in my other test SWF
files and they have actions in them, and they're set up the exact
same way -- but they work...
The whole site is new, so every SWF is CS3/AS3. I'm not even
doing anything crazy, so I'm getting pretty frustrated trying to
build an all AS3 site and I can't even do basic stuff....
I can upload/email the FLA files in question if anyone has
time to look...
Thanks,
BrandonWell, when I test the loaded SWF within the Flash environment
(by itself), it plays just fine.
Then, I try to play the root containing movie (both within
Flash and on the web server) and as soon as that section loads, is
when the error occurs.
I've tried tracing everything. even down to putting trace()
actions between every layer. Can't determine what causes it...
One thing I noticed (but I assume is a naming convention that
Flash uses), is in the error above you see "test_fla", well, lets
say I have these files:
test-container.fla
test-home.fla
I don't have a test_fla, but the error code refers to it
anyway... -
Communicating to a loaded .swf
So, I have finally figured out how to preload, and gotten my main movie to load an external swf properly. My last hang up, is how to speak to that loaded swf, with a button added above it in the main timeline.
So, my button is Nextbtn (added via addChild), and my swf is titled "about_mov.swf", when it is loaded, it goes to frame 10 and stops, what I want to happen, is when you click the NextBtn, that loaded swf advances to frame 11. Just not sure how to reference it properly, and hping i can get a quick solution on it. Thanks!if you want to load and display more than 1 swf at any given time, you'll need to use more than 1 loader. further, if you want to reference those swfs you'll need to use different references for the loaders.
-
Last and greatest: conditional statements for click referring to loaded swf
Hey forum,
I am so close to being done with this site update it is exciting! I will be sure to throw it up here for you to see, since without this forum I would have been hurting!
The last big hurdle I have, is the following, and I hope someone can just throw me a bit of guidance on this.
I am looking for a way to write a function, that on click of my "next" button in the main timeline, will refer to my loaded swf MovieClip(imageLoader.content) telling it to go to the next frame label, so really a compound if/then situation – just referring to the loaded file throws me.
So, my next button is "pNext," and what I am looking for is something along the lines of:
if (loaded movie) is on frames 12-144, then go here (on click),
if (loaded movie) is on frames 144-155, then go here (on click)
etc. and so forth.
Thanks so much! Below is my code that works on one next click, so you can see the instances etc.
b
pNext.addEventListener (MouseEvent.CLICK, nextClick);
function nextClick (e:MouseEvent):void{
MovieClip(imageLoader.content).gotoAndPlay ("aboutS1");If I'm reading your request right, what you can try is to create an array of the frame labels in the order they appear and use the currentLabel property to determine where you are and indicate where to go...
var labels:Array = new Array("one","two","three","four","five"...etc...);
pNext.addEventListener (MouseEvent.CLICK, nextClick);
function nextClick (e:MouseEvent):void{
var mc:MovieClip = MovieClip(imageLoader.content);
var nextLabel:String = labels[labels.indexOf(String(mc.currentLabel))+1];
mc.gotoAndPlay (nextLabel); -
Map and externally loaded swf working together
Here's the setup:
I have a panoramic viewer, and i'd like to have a map go
along side it. The panoramas are loaded externally into the player.
Inside these external swf files are "hotspots" that link to other
panoramic swf files that load and take the previous swf's place. I
have all of this set up, and you can see how I did it in my
previous post:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1274410&enterthread=y
So now my new question is... how can I have a map with points
on it, that when you click on a point, it will load a corresponding
swf file into the player. I believe that part is easy. My big
problem is if someone clicks on a hotspot in the external swf file
first, which in turn loads another swf file, and if that person
goes back to the map, I want the map to change the position of lets
say, a marker or a pin to indicate the new position on the map that
correllates to the new external swf that was loaded.
make sense? Any ideas? I was thinking maybe it would be some
kind of listener or something so that should a specific swf load,
it will recognize it and automatically change the location of the
marker on the map to the point that relates to the loaded swf or
something...Hi Thanks for your reply, I tried with a small AS3 file as
well and I get the same ERROR.
Maybe you are looking for
-
Face time activation - an error occurred while verifying your email
i can't get facetime to work on my iPad - i go to settings add my account details and password (i know they are correct as i just logged onto my apple account and they worked fine) - and when i click on "next" the message that comes up is "an eror oc
-
How do I find out what my security questions are?
I have tried using a different email and have followed the directions but they keep bringing me back to where I started, I just want to be able to purchase things again!
-
My printer was working fine wirelessly when I noticed it flashing and a message to turn off and back on, which I did. All I get it what looks like a timer button on the display with a code. I have tried to reset several times and sometimes the code c
-
Communication Error with Brother MFC-620CN Printer works but not scanner
Only printing works off the airport extreme but not scanning. Tried to mannually add the printer in the control center or device selector but printer cannot be found. Scanner worked prior to software upgrades. In addition, I get the communication err
-
From 10g, "SQL Statement Length" description disappeared....
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10755/limits003.htm#sthref3594 From 10g, on the above 'Logical Database Limits' section of 'Reference' document, the description for 'SQL Statement Length' limitation (64K) has been droppe