ActionScript 3.0 :: Control Root With An Externally Loaded Swf?
Jul 26, 2010Can I control my main timeline with an externally loaded swf?
View 9 RepliesCan I control my main timeline with an externally loaded swf?
View 9 Replies
Is it possible to tell an externally loaded swf what its root is?
These swf's I want to load in:
main.swf --> manager/g1/viewer.swf
In the main.swf I want to tell the viewer.swf:
your root = ../manager/g1/
So the viewer.swf can read the external xml and images from its own root. (../manager/g1/)
I'm working on an flash movie and the interface is a small town (simiar to "doritos.com" and "comcasttown.com") if you reference both the doritos and comcast sites their little movie runs smoothly. I have several elements in the town. For example, one of the elements is an airplane hangar. When you rollover the hanger, I created a movie, the doors open and an airplane flies out of the hangar. I have several little movies throughout the interactive such as this. I created the hangar animation as a seperate swf file. In my main movie I created a button, on rollover it loads the hangar swf into an empty movieclip. When I publish and view the swf it plays slow and choppy. First, is it possible to write actionscript to load the external swf ,but it stops on the first frame of the animation and when you rollover it continues to play.To put it all in a nutshell, I want to create several buttons throughout the movie with loadmovie functions, once the swf movies are loaded I want them to stop on the first frame of the animation and when you rollover loaded swf movie I want it to continue to play the animation. Should actionscript be applied to the swf movies first and preloaded into the main movie. And what will make the movies run smoothly once it's published and viewed in a browser.Also if this makes a difference, I created the animations in after effects, exported them as FLVs imported them into flash and exported them as swf. Again it runs really slow and choppy
View 1 RepliesI am using Flash CS3. I have a dynamic text box that scrolls text loaded from an external txt file (made in Notepad).
I was wondering if there is a way that I could better control the style (color, font size, bold, paragraph breaks, etc) of the text?? I know that in flash I can specify the font type, size and alignment. But I want to also make some parts of the text BOLD and DIFFERENT COLORS. Perhaps I can use html tags within Notepad to do this?? If so, HOW??...beacuse I have tryed and it didn't work....the tags just showed up in the flash file along with the text, it didn't read them as html (and yes, I set my dynamic text box to render html).[code]...
i am loading external swf's inside a movieclip...is it possible to control the playback of the externally loaded swf, i mean i want to play and pause that swf file within the main movie..
View 2 RepliesIs there a way to control the playback of an externally loaded .swf?
I'm using the MovieClipLoader class to bring an external .swf into my "main nav" .swf, and I would like to allow the user to pause and resume playback of the external .swf.
How might I accomplish this?
here's what I have so far:
Code:
this.createEmptyMovieClip("mcHolder", this.getNextHighestDepth());
var mclLoader:MovieClipLoader = new MovieClipLoader();
var oListener:Object = new Object();
[Code].....
I am trying to load multiple swfs (one at a time) using one loader and pause/play the loaded swfs using a button. I have gotten the swfs to pause/play, but all except for one will delete itself upon resuming. I made the loaded swfs in Captivate. Each Captivate swf is made up of multiple Flash swfs, each on its own slide. When the swfs delete, they only delete the currently playing slide's swf and then the next slide's swf will appear and play when the timeline advances to it (but will also delete if paused/resumed), but the playbar will show that the swf has been successfully paused and restarted and will continue along with no swf showing.
Here is a short version of my code (becuase the original has 8 swfs to choose from):
function(){return A.apply(null,[this].concat($A(arguments)))}//HERE STARTS THE ATTACHMENT BUTTONS REFERENCING FROM THE mainMC
var ansaldoButton:DisplayObject =
[Code].....
I have a set of SWFs loaded, and have successfully added them to the stage, and can assign basic methods ( gotoAndPlay(), stop() etc..) based on MouseEvents. I can't quite figure out, however, how to assign methods based on frame number or label, triggered by labels on the currently playing SWF timeline. So, for example: externally loaded swf starts playing, and a listener is set up to listen for a "stop" label, which would activate stop();I can obviously just drop a stop(); in the timeline of the loaded swf, but I am really trying to banish all code from timelines, period.
I could set up a frame-based listener to decide if a label exists at the current frame, and then to evaluate if that frame label == "stop"... but that seems pretty messy, and because it has to run at every frame, CPU heavy...So - the question is really about listeners, I guess. What event would I listen for? Something like a MouseEvent - but ... a LabelEvent instead Obviously - this doesn't exist, but something like it would be perfect. tions scattered here and there isn't that big of a deal
I was trying to get two swfs loaded into a main swf to control each others timelines. This is what I've tried out:
Code:
Select allpackage{
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.*;
import flash.net.URLRequest;
import fl.transitions.easing.*;
import caurina.transitions.Tweener;
public class LoadTest extends MovieClip{
[Code] .....
I have my main movie that has a container movieclip called vulture_container_mc. That container MC loads "vulture_mc.swf" into it. There is a button on the main movie that loads that swf into the container MC. I did the if statement in the beginning so the person couldn't keep reloading the animation when you click on the button over and over. It works so they can't do that, but now they can only press the button once, after that one time the button doesn't work.
Here is the main movie I'm talking about:
>>Main Movie<<
The vulture animation when you click the email button is the external swf file. I would like to make it where they can't keep reloading the animation (which works with the if statement, but I also need it so you can press the email button again after the animation is done to cause the vulture animation and email link to work again.
Here's the code in the email button:
Code:
on (release) {
if (vultureClicked == 0) {
loadMovie("vulture_mc.swf", "_root.vulture_container_mc");
[Code]....
I have my main movie that has a container movieclip called vulture_container_mc. That container MC loads "vulture_mc.swf" into it. There is a button on the main movie that loads that swf into the container MC. I did the if statement in the beginning so the person couldn't keep reloading the animation when you click on the button over and over. It works so they can't do that, but now they can only press the button once, after that one time the button doesn't work.
Here is the main movie I'm talking about:
>>Main Movie<<
The vulture animation when you click the email button is the external swf file. I would like to make it where they can't keep reloading the animation (which works with the if statement, but I also need it so you can press the email button again after the animation is done to cause the vulture animation and email link to work again.
Here's the code in the email button:
Code:
on (release) {
if (vultureClicked == 0) {
loadMovie("vulture_mc.swf", "_root.vulture_container_mc");
[Code].....
I have 2 swf files. One is loaded and loading an externally loaded swf into it.Here is the code in the first loaded swf: #1
var logo:Loader = new Loader();
logo.load(new URLRequest("images/Logo.png"));
logo.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadLogo);
function LoadLogo(e:Event):void
[code]....
EDIT:I am having major SANDBOX issues now when I make the clip load from an external URL. I am also coding for an ANDROID using FLASH CS5.5. Its not allowing me to use Security.allowDomain("*");
I have a basic xml driven portfolio. The xml file holds the path to the portfolio pieces (external .swfs). I have a main navigation that moves from project to project and a subnavigation to view individual pages of that project.The subnav is where I have the problem, I simply want to call gotoAndPlay("framelabel") of the designated mc. It seems that you can no longer call to the timeline of child movieclips as you could with AS 2. I've found some examples Except the examples discuss access of nested movieclips on the stage with assigned instance names. But the problem I'm facing is that I have each item pulled in via the loader Class then the objects are pushed into an array and my subnav needs to access them dynamically via array notation.something like this:
PHP Code:
public function loadMe(){
//var l:Loader = new Loader();
[code].....
I have a root stage, and a MC that is called from the root stage.Now from that MC, i will called in another MC2, and I wanted to placed the MC in the center of the stage. The reason I could not use normal ADDED_TO_STAGE at MC and define the center is because MC is not place in the exact position of the root stage (as in x, y=0). So if I would target MC2 at MC stage center, it would not be the exact center of the root stage/screen.How can I called the root stage properties rather than adding MC2 into the stage?
View 1 RepliesI am in the process of building a site for an Architect... Jamie Fobert Architects (projects) I am useing transitions between the projects and am loading details/text and images externally through flashvars, php and a mySQL database. Within my transitions I have a a preloader on the forst 2 frames the code is as follows (taken from a Voetsjoeba tutorial):
[Code]....
This works pretty well if the content is within the .swf, but when it is loaded externally it doesnt preload it at all. Does anyone know how I can adapt/improve this preloader? or somehow ensure that all the content being loaded externally is loaded before the transition plays?
I am loading an externally loaded swf that uses a mask to transition in. When the user clicks a different button I am doing a gotoAndPlay that goes to a mask that "unloads" the content (it doesnt actually unload the info is just outside of the mask area. As soon As I jump to that section the movie is no longer loaded and just shows the container clip that I had created for it. The Container Clip is never changed and is the same throughout the whole process. The only thing that changes is the mask animation.I have tried both loadClip and loadMovie but no luck on keeping the clip loaded.
EDIT - I have narrowed it down. When I change the mask movieclip the movie unloads for some reason. Is there a way I can keep it loaded?
i have a MC that load another MCwith an XML photogallery and i was wondering how could i control externally this gallery.Basically if i want different button of the MC to control the MC with the xml photogallery , example i want button 3 to load the xternal gallery.swf and to load image 2 from the xml...i know is confusing and i am not even sure if it can be done.
View 14 Replieshere is the AS i am having trouble with
[AS]
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
_root.this.nextFrame();
[code]....
I want to make it so when i roll over my movie clip (that i attach this AS to), a different movieclip is controlled. This AS
[AS]
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
[code]....
Works great, when using 'this' for the prev and next frame control but i cant figuire out how to control a different movieclip on root.
In Flash CS3 using Action Script 3, how can I tell the main timeline to gotoAndStop(); a certain frame from within a movie clip.
I have a menu (which is a movie clip) with various buttons. Each button corresponds to a certain frame in the main movie. So if a user click on Button1, it should gotoAndStop(1); and Button2 should gotoAndStop(2); and so on.
In Action Script 2, I could use _root.gotoAndPlay(2); from what I understand, but that does not work in Action Script 3.
I've been trying to switch from AS2 to AS3 by forcing myself to use AS3 on every project and never revert to AS2 no matter what the problem may be. Doing this, I've learned a lot so far, and it has shown me that AS3 has the potential to be much more logical and easier to manage, but every once in a while I run into a problem in which research doesn't prevail.
At the moment I'm working on a project that uses the Union Platform. My goal is to make all control over User1's "Reactor" API managed by a single class.
Anyways, I've ran into a very limiting problem that I can't seem to get by. I can't figure out a way to call the root object and be able to call it's functions from a class!
Here's one of the methods that I've tried (No errors were reported, but it did not work) -
main.as:
Code:
package {
import flash.display.MovieClip;
import net.user1.reactor.Reactor;
[Code]...
As you can see, I tried to pass "this" as a MovieClip in hopes that I would be able to use the MovieClip's class functions. (Which is most likely very nooby and completely wrong since it's probably not considered a MovieClip reference, but what do I know?) Everything is fine, except the swf does not go to frame 2 when readyListener() is called. No errors are outputted either.
here is the AS i am having trouble with
[Code]...
I want to make it so when i roll over my movie clip (that i attach this AS to), a different movieclip is controlled. This AS
[Code]...
Works great, when using 'this' for the prev and next frame control but i cant figuire out how to control a different movieclip on root.
I have a homepage with five "links" to each swf. Now the first swf I have a custom cursor that hides the mouse. When I click on that link it plays and when I quickly go to the homepage again it hides the mouse there when it's not supposed to do it.
Same with every other link. When I was busy with the first swf and want to go to the last swf of the five, my mouse just disappears! It is almost as if it keeps on "playing" without seeing the swf...
Here is the code that I have so far!
var currentpage:uint = 0;
//one loader object per project:
var loadingobject1:Loader = new Loader();
loadingobject1.x = 445;
[Code]....
i'm having some "big" issues with what seems like a pretty easy flash concept. But, im pretty green when it comes to coding in flash.
I have a SWF thats being externally loaded into another SWF file (see code below):
on(release) {
loadMovie("test1.swf",_root.dropZone);
}
(If i'm understanding the above code correctly...its loading the SWF into a blank MC i created called dropZone) This part seems to work correctly when tested.
I've got 4 different SWF's that need to be loaded seperatley when its coresponding button is clicked. The issue arises when I import the external SWF file...it resizes itself to the size of the flash stage. I need all the SWFs to be loaded and remain there original size (1257x847) or be scaled to the correct size. Then if I click another button it should load the new SWF and "unload" the old SWF.
if a loader can be added to let the user know the video is being loaded rather than a blank 20-30 seconds...
View 18 RepliesI'm loading swf's via an XML file. I'm wanting them to be added onto the stage in the same order that they appear in the XML. The problem that I'm having is that they are added to the stage only when they are fully loaded.
This is my xml (_config.xml)
<campaign>
<component SWFsource="logo.swf"/>
<component SWFsource="gallery.swf"/>
[code].....
I have a fairly chunky swf that I am loading through the loadMovie function. Just wondering if a loader can be added to let the user know the video is being loaded rather than a blank 20-30 seconds...
View 1 RepliesWith the assistance of a very kind member of this forum, I have got as far as getting an .FLV to load into my API via its own .SWF.
[URL]
click on "Animalia - Verse from the Zoo" to load the VideoPlayer .swf which contains the .FLV
I will add more functionality when I've solved this. Now that I have a Video Player which closes, the next set of hurdles to overcome are these:
Click "Close" with the .FLV playing and the sound keeps playing because the .FLV is still playing. Click "Close" with the .FLV paused and when you call the player back, it plays from the same spot. So, my tiny brain says it's an "add/removeChild" issue. Obviously when happy user clicks "Close" and then re-loads by clicking "Animalia", happy user wants the video to play from scratch. That's what I want, anyway. Not from where it left off after clicking "Close". I've made several attempts at adding a "remove FLV" object to the function and Event Dispatch method, but what I did is wrong because the code I put in removed the .FLV permanently and when you call the player back by clicking on "Animalia", the .FLV does not play at all. I'm going round in circles looking for the correct NetStream/removeChild/unload.nsplay/etc/etc .. AS3 coding and where to put it.
My .FLV video load object on "NewPlayer.swf" is:
var myVideo:Video = new Video(360, 264);
addChild(myVideo);
var nc:NetConnection = new NetConnection();
[Code].....
My questions is:- What is the correct coding to get the VideoPlayer .swf to unload its .FLV completely, SO THAT when a user clicks "Close". Either with or without the .FLV playing, everything closes completely and when re-loaded, the video plays from scratch?
I am externally loading an flv into an empty movie clip container using loadMovie into a main swf. The flv is in a standard flv playback component and works fine on its own. But what I'd like to be able to do is pause the flv when any of the buttons in the main swf are pressed.
View 7 RepliesI was wondering if there was a way in Flash to preview externally loaded images in Flash while still working.I am loading images externally to keep the file size down on a piece of elearning but now I'm afraid maintenance will be a nightmare since you don't actually see the screens until you publish. I have interactions on the screens so I need to see them for their placement on screen.
View 5 RepliesI have the action script that loads external SWFs on a button click, but I don't know how to make it so that the slides switch after a few seconds on their own as well as on a button click. I know it has to do with a timer - but I have no idea how to do that (i'm super new to AS) Can someone please either tell me what code I need there or direct me to atutorialHere's the code I'm using so far:
var Xpos:Number = 0;var Ypos:Number = 0;var swf:MovieClip;var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/one_btn.swf");
[code]......