Code Help Loading External Swf
I would love to get some feedback on my code. I am trying to get six seperate swfs to load depending on which btn is clicked and it I get these errors: TypeError: Error #2007: Parameter listener must be non-null.at flash.events::EventDispatcher/addEventListener()at mainSun72_fla::gallery_12/galleryload() TypeError: Error #1009: Cannot access a property or method of a null object reference.at Script/::xmlLoaded()at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()at flash.events::EventDispatcher/dispatchEvent()at flash.net::URLLoader/flash.net:URLLoader::onComplete() Any ideas why this isn't working. The seperate swfs work when tested but not through here. Thanks for taking a look. ActionScript Code: stop();var galleryswfloader:Loader = new Loader(); galleryswfloader.x = -3; galleryswfloader.y = -86; var galleryrequest:URLRequest; var backBtn:btnBack = new btnBack(); backBtn.x = -26; backBtn.y = -27; gallerymenu_mc.wed1_btn.addEventListener(MouseEvent.CLICK, galleryload);gallerymenu_mc.wed2_btn.addEventListener(MouseEvent.CLICK, galleryload);gallerymenu_mc.wed3_btn.addEventListener(MouseEvent.CLICK, galleryload);gallerymenu_mc.wed4_btn.addEventListener(MouseEvent.CLICK, galleryload);gallerymenu_mc.wed5_btn.addEventListener(MouseEvent.CLICK, galleryload);gallerymenu_mc.wed6_btn.addEventListener(MouseEvent.CLICK, galleryload); function galleryload(event:MouseEvent) { switch (event.currentTarget.name) { case "wed1_btn" : galleryrequest = new URLRequest("oneGal.swf"); galleryswfloader.load(galleryrequest); galleryswfloader.addEventListener(Event.COMPLETE, gogallery1); function gogallery1(E:Event):void{addChild(galleryswfloader); addChild(backBtn);} trace("wed1"); break; case "wed2_btn" : galleryrequest = new URLRequest("twoGal.swf"); galleryswfloader.load(galleryrequest); galleryswfloader.addEventListener(Event.COMPLETE, gogallery2); function gogallery2(E:Event):void{addChild(galleryswfloader); addChild(backBtn);} trace("wed2"); break; case "wed3_btn" : galleryrequest = new URLRequest("threeGal.swf"); galleryswfloader.load(galleryrequest); galleryswfloader.addEventListener(Event.COMPLETE, gogallery3); function gogallery3(E:Event):void{addChild(galleryswfloader); addChild(backBtn);} trace("wed3"); break; case "wed4_btn" : galleryrequest = new URLRequest("fourGal.swf"); galleryswfloader.load(galleryrequest); galleryswfloader.addEventListener(Event.COMPLETE, gogallery4); function gogallery4(E:Event):void{addChild(galleryswfloader); addChild(backBtn);} trace("wed4"); break; case "wed5_btn" : galleryrequest = new URLRequest("fiveGal.swf"); galleryswfloader.load(galleryrequest); galleryswfloader.addEventListener(Event.COMPLETE, gogallery5); function gogallery5(E:Event):void{addChild(galleryswfloader); addChild(backBtn);} trace("wed5"); break; case "wed6_btn" : galleryrequest = new URLRequest("sixGal.swf"); galleryswfloader.load(galleryrequest); galleryswfloader.addEventListener(Event.COMPLETE, gogallery6); function gogallery6(E:Event):void{addChild(galleryswfloader); addChild(backBtn);} trace("wed6"); break; } } function goback(event:MouseEvent):void { this.removeChild(galleryswfloader); this.removeChild(backBtn); }
KirupaForum > Flash > ActionScript 3.0
Posted on: 12-02-2007, 01:34 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[F8] Loading And Unloading External SWF Code Issues, Code Check Please
Okay, I'm still clumsy with AS and I'm having problems loading and unloading external SWFs. I have SWFs created by others in Captivate that need to be controlled by a main menu. I created the menu and buttons and have been trying to code it so that with the button click, the appropriate external SWF loads in an empty movie clip, plays, and then closes at the final frame and returns to the menu. So far, I can get it to load, but then I'm stuck as I'm not sure what I'm missing as far as it reading the frame numbers.
Here's the code I've written. I can't seem to get my idea for the onEnterFrame function checking the frames to work.
What am I missing? Can anyone offer any suggestions or guidance? Thanks!
Code:
this.createEmptyMovieClip("clip1", 1);
myfirst_btn.onRelease = function() {
clip1.loadMovie("externalswf1.swf");
}
mysecond_btn.onRelease = function() {
clip1.loadMovie("externalswf2.swf");
}
mythird_btn.onRelease = function() {
clip1.loadMovie("externalswf3.swf");
}
clip1.onEnterFrame = function() {
if (clip1._currentframe == clip1._totalframes) {
// remove move clip1 and return to menu
clip1.removeMovieClip();
}
}
Loading External Text Into This Code?
hi all...
i have a scroll box that i'm really happy with, however i'd like to be able to load an external text file into it ... however i'm not sure how to go about modifying it to do this...
if someone could show me that would be great!
cheers...
here's the code:
dragger.useHandCursor = false;
targY = 0;
dragger._x = theMask._width;
dragger.onPress = function () {
var _local1 = this;
startDrag (_local1, false, _local1._x, 0, _local1._x, theMask._height - _local1._height);
};
dragger.onRelease = (dragger.onReleaseOutside = function () {
stopDrag();
});
theText.setMask(theMask);
theText.onEnterFrame = function () {
var _local1 = this;
scrollAmount = (_local1._height - (theMask._height / 1.3)) / (theMask._height - dragger._height);
targY = (-dragger._y) * scrollAmount;
_local1._y = _local1._y - ((_local1._y - targY) / 5);
};
Need Code Help For Loading External Swfs
hi
im using this tutorial http://www.kirupa.com/developer/mx2004/transitions.htm to help me understand how to build a site that will load external .swfs . The problem is it offers the code is made to apply on butttons and i really need it to work with my rollover mc buttons. any suggestions at code that will work with my MCs and do the samething?
here is the orginal code:
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "main";
container.loadMovie("main.swf");
} else if (_root.currMovie != "main") {
if (container._currentframe >=
container.midframe) {
_root.currMovie = "main"; container.play();
}
}
Need Code Help For Loading External Swfs
hey this is my first post here i cant solve this probelm
hi
im using this tutorial http://www.kirupa.com/developer/mx2004/transitions.htm to help me understand how to build a site that will load external .swfs . The problem is it offers the code is made to apply on butttons and i really need it to work with my rollover mc buttons. any suggestions at code that will work with my MCs and do the samething? any suggestions or alternate code?
here is the orginal code:
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "main";
container.loadMovie("main.swf");
} else if (_root.currMovie != "main") {
if (container._currentframe >=
container.midframe) {
_root.currMovie = "main"; container.play();
}
}
Loading External Swf/jpgs Code
Hello!
Just put up this site here:
http://www.zoeelizabeth.com.au/
The only bug I seem to have is that when any section/image is selected, the site tries to load the swf/jpeg twice!
I know it has something to do with the script im using to laod the site.
In Safrai - if the 'about' section is selected first it doesn't load at all..!
Here's a snippet of my code:
Code:
function mainMenuAction(id:Number):Void{
if (id != 0){
changeSection(id);
hideThumbs();
_root.bgImage_mc.blank.alphaTo(0,1)
}else{
resetMenu(0);
buildThumbs();
_root.content_mc.alphaTo(0,0.5);
}
}
function changeSection(id:Number):Void{
//resetCollectionMenu();
trace("change section");
//trace("collectionSection: " + collectionSection);
resetLoader()
resetMenu(id);
content_mc.alphaTo(0,0.5,"easeInQuad",0,loadContent);
content_mc.Blur_blurTo(50,0.5,"easeInQuad",0,loadContent);
function loadContent():Void{
trace("load content");
loadMovie(contentArray[id] + ".swf", content_mc);
loader_mc._visible = true;
loader_mc._alpha = 0;
loader_mc.alphaTo(100,0.5,"linear");
loader_mc.Blur_blurTo(0,2,"linear");
_root.onEnterFrame = function(){
actBytes = _root.content_mc.getBytesLoaded();
totBytes = _root.content_mc.getBytesTotal();
percent = Math.round(actBytes * 100/totBytes);
loader_mc.loadingBar_mc.xscale = percent;
if ((totBytes == actBytes) && (totBytes > 4)) {
finishedLoadingContent();
}
}
}
function finishedLoadingContent():Void{
trace("done loading");
delete _root.onEnterFrame;
//content_mc.play();
loader_mc.alphaTo(0,0.5,"linear",0,killLoader)
loader_mc.Blur_blurTo(0,0.5,"linear");;
}
function killLoader():Void{
loader_mc._visible = false;
_root.content_mc.alphaTo(100,2);
content_mc.Blur_blurTo(50,0);
content_mc.Blur_blurTo(0,1,"easeOutQuad");
}
}
function resetMenu(id:Number):Void{
for (i = 0; i < contentArray.length; i ++){
menuItem = nav_mc.menu_mc["item_mc" + i];
menuItem.hitState_bt._visible = true;
menuItem.label_mc.scaleTo(100,0.8,"easeInOutQuad");
menuItem.label_mc.alphaTo(100,0.5,"easeOutQuad");
//menuItem.colorTo(null,0.5,"easeOutQuad");
}
selectedMenuItem = nav_mc.menu_mc["item_mc" + id];
selectedMenuItem.hitState_bt._visible = false;
selectedMenuItem.label_mc.scaleTo(110,0.5,"easeOutExpo");
selectedMenuItem.label_mc.alphaTo(35,0.5,"easeOutQuad");
//selectedMenuItem.colorTo(0x000000,0.5,"easeOutQuad");
}
:?
Help Loading External Links Into AS2 Code.
I am on an imac. Running Mac OS 10.4.11. I'm using Flash Ver. 9.0.
I've created an animated slideshow, that I'm trying to make externally updateable. I have linked all of my pictures to exteral locations, successfully, as well as all of my text. The only problem, I'm not sure how to understand, is making the links updateable.
Is there anyway to insert into my code, a string similar to that which links dynamic text to an external .txt file? I want to be able to have one of our interns to be able to just drop a link on a .txt file and upload that to a server location, that my file will draw from.
Thank you in advance.
Help Loading External Links Into AS2 Code.
I am on an imac. Running Mac OS 10.4.11. I'm using Flash Ver. 9.0.
I've created an animated slideshow, that I'm trying to make externally updateable. I have linked all of my pictures to exteral locations, successfully, as well as all of my text. The only problem, I'm not sure how to understand, is making the links updateable.
Is there anyway to insert into my code, a string similar to that which links dynamic text to an external .txt file? I want to be able to have one of our interns to be able to just drop a link on a .txt file and upload that to a server location, that my file will draw from.
Thank you in advance.
Having Problems Loading External CSS (attached Code)
okay here is the deal I created a dynamic text field in which to load an external html file. the file loads fine but when I try to attach an external CSS it does not load the CSS. I tried opening the html file in DW and it works fine CSS and all, but not in flash, I am using the code straight out the help, and the samples. I think the sample that comes with MX Pro is wrong b/c if you copy and paste the code, it gives error messages. I've tried my own variations to it also, I am loading the html as an XML object Here it is:
var ss = new TextField.StyleSheet();
ss.load("news.css");
ss.onLoad = function (ok) {
if (ok) {
content_txt.styleSheet = ss;
}
}
content_txt.html = true;
content_txt.multiline= true;
content_txt.wordWrap = true;
//load external html file into dynamic txt field
story = new XML ();
story.ignoreWhite = false;
story.load("news.html");
story.onLoad = function () {
content_txt.htmlText = story;
}
does anyone know where I am i going wrong?
Thanks.
LoadMovie Loading External Swf, Need Preload Code?
http://www.cstreiter.com/portfolio.fla
^^source is available here. (1.61 mb)
Hey there,
I'm using the script:
createEmptyMovieClip("targetMovieClip", 1);
loadMovie("portfolio.swf", targetMovieClip);
targetMovieClip._x = 45;
targetMovieClip._y = 175;
Although, you can't notice it on a broadband connection, the file is around 1.08 mb and loads with no issues (it appears almost instantly) however if a user on a phone line were to visit my website, it takes so long to load, any way to put a preloading script on my portfolio'a SWF so i can use the loadMovie script and it will appear and say Loading..??
Thanks,
Chris
External Clip Loading Code Not Working
Hello everyone in this forum.
here is my problem.
I have a swf in wich i created an empty mc called container, that in the stage is suposed to workas container to external swfs.
So I had one instace name lats say gallry and in a frame from the main I have a external being loaded into gallary.
This works jus fine.
Now another swf is to contain my main movie as described:
MOVIE1
[may main movie
container
gallery movie]
Can any one explain howcome the gallery is not loaded to the container.
Must I give the complet path to the container.
or should I insert the loading code in the container it self and no path.
Kind of: loadMovie("***", "this");
any help wellcomed.
Greatings once more
SMITH
Portugal.
NEWBIE Q: Loading External Txt File Into This Duplication Code
Hi,
Thanks for reading. I found this code demonstrating how to duplicate a movie clip.
Code:
num = 4;
ystart = 0;
n = 1;
while (n <= num) {
duplicateMovieClip("display", "display" add n, n);
setProperty("display" add n, _y, ystart + n*121.5);
n = n + 1;
}
It works a treat but I now want to add something in so that it will load some variables from a corresponding txt file into each of the new clips.
The first txt file is called display.txt, the next txt file is called display1.txt and so on where the number in the name of the file is 'n' from the code above. After mucking around for a while I am still unsure how to get this into the code. I am obviously just getting the syntax wrong or something.
Put very simply, all I want to achieve is to get the code to loadVars into each of the new clips so that -
'display' loads variables from 'display.txt'
then the new movie
'display1' loads variables from 'display1.txt' and so on....
I hope I have explained this well enough. Anyone have any idea?
Thanks in advance,
Jman
Whats Wrong With This Code? [loading External Image]
I'm trying to get a picture be loaded into an empty movie clip ("imageLoader") that is placed on the frame. The picture ("en_image1.jpg") is in the same folder as the flash movie...but when I view it, it only displays a small white box (doesn't load the picture).
Code:
function startLoading() {
loadMovie("en_image1.jpg", "imageLoader");
}
startLoading();
Code For Loading Multiple External SWF Files In Sequence?
Hello! I have a fla file that I've created to load 7 external swf files. I am able to create the code to load one swf file without any trouble but I can't figure out the code to get it load swf #2 when #1 is done, and so on. My code for one is below:
var imageRequest:URLRequest = new URLRequest("burbank_opener.swf");
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);
addChild(imageLoader);
I'm fairly new to AS3 but this seems like a pretty basic thing to do. Any suggestions on what to add to my existing code to get it to load in sequence? Thank you!
Code Breaks When Loading External Movies Into Main Movie
Hello everybody,
I have a problem that I am trying to solve. I created a small project where I am loading external movies (swf) inside the same MC on stage in main swf. When I play these external movies separately they are working just great. In case, when I am loading them into main MC(shell) and playing them twice or more then it becomes messy. The movies are not playing right.
I am using classes to tween and all animations are coded. I preload all movies in browser's cash first. All external movies are using the same tween class. It is possible that some interference of codes has a place since all of them are on the same level. It seems like the code breaks when I load movies. I am wondering if you have any ideas on how to solve this problem.
Any advice is highly appreciated,
Thanks.
External SWFs, Code Works But Not With Additional Code
I'm using a loadMovie code that works perfect by itself, but when I add additional code to the button, it doesn't work.
Here's the scenario:
I have an MC named songs In this MC I have several buttons that should each perform very similar actions.
The first action is a:
gotoAndPlay("somewhere"); action that takes the movie to a specific frame of this MC. This code by itself works fine.
The second action I need to happen is:
this.contents.loadMovie("music1.swf") which loads an external SWF which is nothing more than an MC with an audio clip. This code, by itself works fine.
The problem comes when I combine the two codes to create:
on (release)
{
gotoAndPlay("somewhere");
this.contents.loadMovie("music1.swf");
}
The movie does go to the "somewhere" frame, but the external SWF no longer loads.
I have tried it with _root.songs.contents.loadMovie("music1.swf");
I have tried placing the loadMovie code first, but neither of those solutions work.
Any ideas?
Thanks
Loading External SWF From External SWF Onto An Empty MC On Main Timeline?
Hi Everyone,
Please bear with me while I explain. I have an external swf that loads into a frame in the main timeline, into an empty MC. I can do this just fine. Once this clip is loaded, I have a button in this clip that loads another external swf into a different empty MC on the main timeline. I'm using loadMovie, and I need to load these movies into specific empty MCs. In other words,
I have the following:
MainStage: frame 5, contains empty MC "ClipA"; frame 6, contains empty MC "ClipB"
External swf: "Movie1"
External swf: "Movie2"
"Movie1" goes into "ClipA" of frame 5 on Main Timeline; and "Movie1" has a button that loads "Movie2" into "ClipB" of frame 6 on Main Timeline. I need help loading "Clip B" into "Movie2" from a button in "ClipA."
I'm sorry my message is so roundabout - it's not really a complicated situation, but explaining it makes it seem so.
Thank you in advance for any help - I'm assuming it's some sort of _root or _parent issue things I'm not quite understanding.
Thanks!
macgirl
Combining External SWF Loading With Dynamically Loading Text Tutorial
I am trying to combine the external SWF loading tutorial with the dynamic text loading (via XML and CSS) tutorial.
Everything loads fine, except the stylesheet is not applied to the text. It must have something to do with the swf being externally loaded, correct?
Any ideas how to fix this?
Here is the code for Frame 1 of the externally loaded swf.
Code:
//init TextArea component
myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.label.condenseWhite=true;
//load css
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("example.css");
myText.styleSheet = kungFuStyle;
//load in XML
kungFuContent = new XML();
kungFuContent.ignoreWhite = true;
kungFuContent.load("example.xml");
kungFuContent.onLoad = function(success)
{
if(success)
{
myText.text = kungFuContent;
}
}
midframe=10
All the files are in the same dir.
Loading A Frame In _root And Also Loading An External Movie Problems.
First of all, hello everyone and nice to meet you
I have been hacking at a problem for a couple of days now and I am in need of help to solve it. Please excuse my noobishness, but I have a lot to learn when it comes to flash.
Here is my scenario:
I have my main movie (_root)
In the actions layer of my main movie I have:
Code:
this._lockroot = true;
I have a button that loads a new external movie at the end of which I want to load a particular frame in the main movie. I call this from the external movie:
Code:
on (release) {
_root.gotoAndPlay(610);
}
Everything up to here works brilliantly....But my problem arises when I also try to load an external movie onto level 5 at the same time as I am instructing the main movie to play frame 610 from an external movie. I want the external movie to call frame 610 in main, and also load a new external movie on level 5 in the main movie. I have tried about every way of loading movies that I can think of but I can never get the external movie to load along with frame 610 of the main movie. I even tried _root.loadMovieNum("myexternalmovie",5) right after my first root call, like this:
Code:
on (release) {
_root.gotoAndPlay(610);
_root.loadMovieNum("myexternalmovie",5)
}
Is that possible or do I have to approach this entirely differently? Thanks for any responses
Help Problems Loading External Text And Loading The Movie Into The Explorer
Hola a todos!
I have some troubles with my movies. I'll explain.
(Sorry for my poor English - I'm Spanish!)
I'm developing a website for a Real State Agency in Spain. My idea is make it enterely with Flash, but It's the first time I face Flash. I've found in the tutorials of kirupa.com the greatest help! But, still that, I need more help!
My first problem comes when loading the .swf into the explorer. I made a simple .html file that calls the .swf file to be loaded. The explorer says it's loaded, but I have to press the "Reload" button to see the movie. Can you say me why?!!!!
My second problem... well. I'll need a few minuts to explain it!
I have created a main scene. Inside the main scene I load the movies of the different sections of the site. This new movies loaded onto the main movie contain texts from external .txt files. There's no problem with the texts that are just a few words, as in the section "Acerca de". But when I need a bar to show the whole text I find that the bar doesn't work in the first time that the movie is loaded, and you have to click again in the section to access the whole text, I mean, to make the bar work. Have I explain myself?
Well. I think you should visit the site to see my problems.
Is this: http://www.wk-inmobiliaria.com/FLASH
This website is, of course, incomplete. I'm still working on it.
Could someone help me????
---- Help me Obi Wan: You're my only hope!!!!
Thanks a Lot.
Raul.
Combining External SWF Loading With Dynamically Loading Text Tutorial
I am trying to combine the external SWF loading tutorial with the dynamic text loading (via XML and CSS) tutorial.
Everything loads fine, except the stylesheet is not applied to the text. It must have something to do with the swf being externally loaded, correct?
Any ideas how to fix this?
Here is the code for Frame 1 of the externally loaded swf.
Code:
//init TextArea component
myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.label.condenseWhite=true;
//load css
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("example.css");
myText.styleSheet = kungFuStyle;
//load in XML
kungFuContent = new XML();
kungFuContent.ignoreWhite = true;
kungFuContent.load("example.xml");
kungFuContent.onLoad = function(success)
{
if(success)
{
myText.text = kungFuContent;
}
}
midframe=10
All the files are in the same dir.
Problem With External MCs, Loading An External Into An External
What I have is 2 seperate files, Main file is the actual website flash, second file is the external movie clip that loads 3 other external movie clips. The site will see the external clip but nothing will appear on the site, blank movie clip only.
On the main site there is this code to load the external clip into the site:
ActionScript Code:
loadMovie("toonsext.swf", _root.toons_mc)
On the external clip these are the codes for loading the 3 characters onto it:
ActionScript Code:
loadMovie("joshtoon.swf", joshblank_mc)loadMovie("toonmatt.swf", mattblank_mc)loadMovie("metoon.swf", meblank_mc)
Seperately the external clip will work and show the characters however on the main site it will not show anything. What could be the problem can flash not load 2 seperate entities like this or is there a code wrong on my behalf?
Problem With Loading New External Mc Before Existing One Has Finished Loading
Hi all,
I've been building a flash website which loads various external movieclips with preloaders into a main movie using either target or level. All is working fine, except when a user clicks on a button to load an external movieclip (the button actually goes to a frame label and then said frame contains the loadmovie action), but then decides to click on another button which loads another movieclip before the original has finished loading. This basically breaks flash, causing the movieclips to start looping erratically (even though I have stop actions in place).
Obviously this problem doesn't occur when I test locally, but please follow this link to see what I mean. Click on the 'locations' or 'recent shoots' sections and then try to load a new movie before an existing one has completely loaded:
http://www.david-vernon.co.uk/365_2/365.html
Now I've experimented with adding 'unloadmovie' to buttons and frames to no avail (though as I'm loading new movies into the same target this shouldn't be the problem surely?), so my only thought is that the preloader actionscript might be causing a problem. Here's the actionscript I'm using on frame 1 of all my external movies:
Code:
stop();
myInterval = setInterval(preloader, 10);
function preloader() {
if (getBytesLoaded() >=getBytesTotal()) {
play();
clearInterval(myInterval);
}
bar._xscale = (getBytesLoaded()/getBytesTotal())*100;
percent.text = Math.round(getBytesLoaded()/getBytesTotal()*100)+"%";
}
I'm not very good with actionscript and I'm really stumped with this, so any help would be greatly appreciated!
Thanks,
Dave
External Swf Loading Into Target Movieclip Loading Problem
Hi Everyone,
Can someone please help me...
I’m trying to load a SWF movie into a target movieclip called ‘blankmc’.
The SWF movie is loaded from an absolute URL (eg. http://www.somedomain.net/img/20042005113934movie3.swf )
My Loading Progress code fails to detect the SWF file size. However the same code works perfectly for a JPG!
Essentially the .getBytesLoaded() and .getBytesTotal fail to work. Why is this and how can I get it to work for loading SWFs?
//EXAMPLE CODE:
loadMovie( URL ,"blankmc");
blankmc.getBytesLoaded() ;
blankmc.getBytesTotal() ;
//This works with JPGs but not SWFs
Thanks in advance!
J
ps. i am using Flash MX
Loading External Images Loading Bar (Movie Clip)
I have managed to have external images loaded with the progress bar. However, when I place these items into a movie clip the preloader no longer works. can someone please take a look at the flash file for me.
http://www.bloggot.co.uk/file.zip
External Swf Loading Into Target Movieclip Loading Problem
Hi Everyone,
Can someone please help me...
I’m trying to load a SWF movie into a target movieclip called ‘blankmc’.
The SWF movie is loaded from an absolute URL (eg. http://www.somedomain.net/img/20042005113934movie3.swf )
My Loading Progress code fails to detect the SWF file size. However the same code works perfectly for a JPG!
Essentially the .getBytesLoaded() and .getBytesTotal fail to work. Why is this and how can I get it to work for loading SWFs?
//EXAMPLE CODE:
loadMovie( URL ,"blankmc");
blankmc.getBytesLoaded() ;
blankmc.getBytesTotal() ;
//This works with JPGs but not SWFs
Thanks in advance!
J
ps. i am using Flash MX
Loading Main Timeline Diff. From Loading External Swf's?
Last edited by enkriptid : 2008-06-30 at 04:16.
hey peoples, im still learning how to load things , my methods are working so far..
what ive been doing to load external swfs is using a intermediate "loading swf" that works between the main timeline and the desired swf to be loaded.. so far it works and is simple enough for me to work with now, but my question is, how do i go about preloading the main timeline if there are mc's being exported .. i tried my previously mentioned method but no dice.. if theres a rock-solid technical answer id like that..my goal is to have most of my site(illsci.com) in actionscript .as files, doc. classes and xml as of now so im looking for a method i can implement using script if i can, if there is one. perhaps a metatag trick of some sort
Loading External Swf Which Load External Txt File
Hi,
My main movie loads an external swf with the following:
code:
createEmptyMovieClip("contRight_mc", 5);
contRight_mc.loadMovie("contHome.swf");
contRight_mc._x = 485;
contRight_mc._y = 0;
contHome.swf loads an external text file and stylesheet:
code:
loadVariablesNum("contHome_no.txt", 0);
globalStyle = new TextField.StyleSheet();
globalStyle.load("global.css");
hdrHome00_txt.styleSheet = globalStyle;
hdrHome00_txt is a dynamic text field with the variable hdrHome00, which is used in the loaded text file:
hdrHome00=<html><body><hdr>text</hdr></body></html>
All files are currently in the same directory. When I test contHome.swf (the swf loaded by the main movie), everything works. But when I test the main movie the text does not load, or at least it does not show up as I receive no errors in the output window, and I can't figure out why. Can anyone help?
Loading External Jpeg Via External Preloader
mx2004
hello all, i have a button which loads an external jpeg from a folder. what i want is to have it so when the command to load the external jpeg is sent, an external preloader preloads it in the placeholder. this preloader will be generic so it can be applied to load before any image selected in any folder, for updating purposes. anyone know where to start with action script, or how to set it up,
Loading External Html Files With External Css Please Help
Hi people,
I'm new to this forum and new to ActionScript. I have not worked on AS1 or AS2 before so I just got started on AS3.
I'm trying to learn ActionScript 3 and I started experimenting with ideas and workinf examples.
What I'm trying to achieve is a website where the content shown is from external HTML files and external CSS.
My code was working up until trying loading the CSS. The error that I'm getting is "Call to a possibly undefined method URLLoader"
here is my code:
ActionScript Code:
import flash.display.MovieClip;
import flash.text.*;
import fl.transitions.*;
import fl.transitions.easing.*;
var bodyTextField:TextField = new TextField();
bodyTextField.x = 50;
bodyTextField.y = 300;
bodyTextField.width = 500;
bodyTextField.multiline = true;
bodyTextField.wordWrap = true;
bodyTextField.autoSize = TextFieldAutoSize.LEFT;
bodyTextField.selectable = false;
var textBox_mc:MovieClip = new MovieClip();
showContent("html_pages/home.html");
function showContent(paraString:String):void
{
var contentPage:String = paraString;
var myURLLoader:URLLoader = new URLLoader();
var myURLRequest:URLRequest = new URLRequest(contentPage);
var myCSSLoader:URLLoader = new URLloader();
var myCSSRequest:URLRequest = new URLRequest("html_pages/demo.css");
myCSSLoader.load(myCSSRequest);
myURLLoader.load(myURLRequest);
//myURLLoader.addEventListener(Event.COMPLETE, dataOK);
myCSSLoader.addEventListener(Event.COMPLETE, dataOK);
function dataOK(myevent:Event):void
{
var css:StyleSheet = new StyleSheet();
css.parseCSS(URLLoader(evt.target).data);
bodyTextField.styleSheet = css;
bodyTextField.htmlText = myURLLoader.data;
textBox_mc.addChild(bodyTextField);
stage.addChild(textBox_mc);
var myTransitionManager:TransitionManager = new TransitionManager(textBox_mc);
myTransitionManager.startTransition({type:Wipe, direction:Transition.IN, duration:0.5, easing:None.easeOut});
}
}
Can someone please have a look and tell me what I'm doing wrong? Thanks.
External Text In External Swf Not Loading In Main Swf
Hi. I'm kind of new to Flash, and am trying to make external text load into an external swf which is loaded into my main swf.
What I have is a swf file where I have buttons that load external text. I then loaded this swf into another main.swf and now the external text will not load. The code i have in the external.swf to load external text is this
but4272005.onRelease=function(){
loadVariablesNum ("4272005.txt","0");
}
but4282005.onRelease=function(){
loadVariablesNum ("4282005.txt","0");
}
but532005.onRelease=function(){
loadVariablesNum ("532005.txt","0");
}
This swf works by itself, but when i load it into the main.swf it doesn't.
I'm sure it has something to do with the "0", but I'm not sure what to put there to make it load correctly in the main swf.
The dynamic textbox i'm trying to load into is named "index_txt". The name of the loader in the main.swf is named "content". Any help would be appreciated.
Problems Loading An External .swf Inside An External .swf
Hey, I created a site using Kirupa's external .swf loading tutorial. Now in one of my externally loaded .swf's, I am loading another external .swf. I've gotten this to work fine, but the second external .swf (loaded into the first) contains buttons that will swap this second external .swf with another external .swf. I can't seem to get the AS references to the variables set up correctly in order to swap the swf's. It sounds rather confusing, so I've included the .fla's and .swf's below.
The file structure:
-band.swf load's profiles_main.swf
-The buttons in profiles_main.swf are trying to load chris.swf (swapping it entirely with profiles_main.swf)
If anyone has a few moments, I'd really appreciate the help.
Problems Loading An External .swf Inside An External .swf
Hiya, I created a site using Kirupa's external .swf loading tutorial. Now in one of my externally loaded .swf's, I am loading another external .swf. I've gotten this to work fine, but the second external .swf (loaded into the first) contains buttons that will swap this second external .swf with another external .swf. I can't seem to get the AS references to the variables set up correctly in order to swap the swf's. The initial .swf loads fine, but the button control gets complicated inside it. It sounds rather confusing, so I've included a link to the .fla's and .swf's below.
http://www.rta.ssxh.net/files.zip
The file structure:
-band.swf load's profiles_main.swf
-The buttons in profiles_main.swf are trying to load chris.swf (swapping it entirely with profiles_main.swf)
If anyone has a few moments, I'd really appreciate the help.
Loading External Files Within External File
Is there a way to load an external file from within an already loaded external file?
Example:
I want to do a section devoted to blog entries. So, I was wanting to externally load the dated references in one textbox on the right side, and when the user clicks on one date, it loads the referenced text file into the larger box next to it.
Any ideas of how to accomplish this?
Thanks!
bbbco
Loading External Images (from External Domains)
Hello kirupa users
I had a small problem in my latest work project where i wanted to load images from external domains.
The problem was that i did not know if i really need the checkPolicyFile set to true or if i really need to load the crossdomain.xml to tell flash player where the acces is.
As far as i know, in adobe as3 reference they stated that in order to load images from an external domain (a domain other than the one where the actual swf runs) you need a policy file or a security acces file in order to be able to do that.
My question is:
1: could i load an image from external domains without having to load some external file (or the crossdomain.xml file)?
2: if there is no possibility to load an image without the crossdomain policy why the checkPolicyFile method could take the value of false?
Thanks in advanced!
Regards.
External Text In External Swf Not Loading In Main Swf
Hi. I'm kind of new to Flash, and am trying to make external text load into an external swf which is loaded into my main swf.
What I have is a swf file where I have buttons that load external text. I then loaded this swf into another main.swf and now the external text will not load. The code i have in the external.swf to load external text is this
but4272005.onRelease=function(){
loadVariablesNum ("4272005.txt","0");
}
but4282005.onRelease=function(){
loadVariablesNum ("4282005.txt","0");
}
but532005.onRelease=function(){
loadVariablesNum ("532005.txt","0");
}
This swf works by itself, but when i load it into the main.swf it doesn't.
I'm sure it has something to do with the "0", but I'm not sure what to put there to make it load correctly in the main swf.
The dynamic textbox i'm trying to load into is named "index_txt". The name of the loader in the main.swf is named "content". Any help would be appreciated.
Problems Loading External CSS With External TXT FMX-2004
hi guys/gals. i'm not so new around here - this site has been a life saver several times, but i'm having trouble finding the answer to this problem i've encountered.
all of the files associated w/ this project are located here, http://www.ohmygraphics.com/test/groovesect/flash.
ok, here's what i'm trying to do.
i have a movie with a button that opens a window w/ a movie clip instance that is draggable. in this draggable movie clip is an external SWF file called "tester.swf". i've tried several times to have a dynamic text field that would load an external CSS file along with a TXT file.
see tester.swf. this is the same TXT w/ the CSS that i want loaded.
here, SITE1.SWF is the final movie w/ "tester.swf" loaded.
as you can see, i got it to load the external TXT file, but not the CSS.
i couldn't get the CSS to load in the SITE1.SWF file, so i thought that since it worked w/ the tester1.swf that i could load an external SWF file and have it work that way. but that didnt' work like i had hoped, which leads me to think that i've got the locations and everything else right in the AS.
i've also uploaded the two .fla files for you guys to look over to see the code. it's pretty simple really, i just don't know why it's not loading the CSS. i thought it might be something with having instances withing instances, but i really have no idea.
thanks in advance for all of your help. it's greatly appreciated.
External Code Thing?
Is there any way to put all my code (functions/prototypes/etc) into an external file, much like the way you could use external style sheets in CSS?
I'm not sure how it would be done, if at all possible? Maybe having all the code in a seperate SWF, then loading that movie into the movie you're working on? But, then the stuff wouldn't be at the _root level, right?
I'm kinda just thinking it through, but it would be really nifty to organize everything and stuff and junk.
Any thoughts?
How Do I Load External .as Code?
Can someone tell me how I load external .as code?
I've tried using the Flash help file...
But I always find it impossible to use and it never has what I need to know!
I'm sure it's really easy!!
Thanks.
OM
Help With Importing External Code
I'd like to import external action script from a text file. I did use the #include command, but this only includes the file at the compile, and I want it to read from the text file after its compiled. So if I changed the text file the flash would change.
I just want to include some actionscript, I don't want to include some variables for dynamic text fields. I've seen that all over the web but thats not really what I'm looking for. Is this possible? Thank you for your time.
Import External Code
I am making many different flash movies, but with almost the same code. So, I would like to have external code that all the flash movies "read" from. So, if I change something I won't have to change all 100 movies.
1. is this possible with flash?
2. How is this done? (include?)
I have flash 8 pro. Thanks.
[F8] Code For External SWF Preloader
Hello, I am not sure where I am missing something in this code. I have a preloader movie that I want to load an external swf on top when finished. Any help would be greatly appreciated.
The preloader movie is only 2 frames long.
First actions frame has:
var amountloaded:Number = getBytesLoaded("av.swf")/getBytesTotal("av.swf");
preloader._width = amountloaded * 200;
loadText.text = Math.round(amountloaded *100) + "%";
The second actions frame has:
if(getBytesLoaded("av.swf") == getBytesTotal("av.swf")){
gotoAndPlay(3);
}
else {
loadMovie("av.swf", _root);
}
[F8] Calling External Code
Hi,
I've searched the web but can't find an answer to this question:
Can ActionScript be used to call into a C++ function?
- Can it be done on Windows, Mac, and Linux?
- Can it be done on Internet Explorer?
- Can it be done on Firefox?
- Can it be done on Safari?
If yes, can someone point me to an example of how to communicate
from ActionScript to C++ and from C++ to ActionScript?
If no, does flash support some kind of script-compiled version?
I have some very intensive actionscript code that is very slow
when running from interpreted ActionScript.
Thanks for reading,
Ignac
External Code Help Moving Mc
I'm working on an assignmetn where I am required to write the code externally (not on the movie clips on the stage). I need to write code to move an object with a keypress. I've got some code that works (I tested a trace statement) but does not move the object. Anybody willing to take a look at the code below and give me some pointers??? The moveCircle is where my problem is.
Thanks!
class Circle extends MovieClip {
// Properties
private var _circle:MovieClip = null;
private var _keytest;
private var _jump:Boolean;
function makeCircle() {
var _circle = _root.attachMovie("ball", "ball", _root.getNextHighestDepth());
_circle._x = 50;
_circle._y = 320;
}
function moveCircle (){
var oKeyListener:Object = new Object();
oKeyListener.onKeyDown = function ():Void {
if (Key.isDown(Key.UP)){
trace("The up key was pressed");
_jump = true;
_root._circle._y -=100;
}//end if
}//end oKeyListener
Key.addListener(oKeyListener);
}//end moveCircle
Using Classes And External Code
ok ive got a lot of help here when i asked about functions i was recomended to use classes im definitly going to go down that road itll make my life a lot easier .
Anyway ive tried not to include anyone else's code into this so i know exactly how everything works but ive got a quick example here i know it might be stupid putting this in a class when i can just use #include but i want to be able to launch it in a similar way to a function
If i can get that into a class then ill be able understand what to do and to do the rest of them myself
Thanks
Code:
var Backgrounds = new Array();
var Width = 1280;
var Height = 960;
var Image = _root.WallpaperMC;
var XAML = new XML();
XAML.ignoreWhite = true;
XAML.onLoad = function() {
var rootNode = this.firstChild;
var temp:String;
for(var i=0;i<rootNode.childNodes.length;i++) {
temp = rootNode.childNodes[i].firstChild.nodeValue;
if(temp) Backgrounds.push(temp);
}
setRandomWallpaper();
}
XAML.load("Site Data/Background.XML");
function setRandomWallpaper() {
if(!Backgrounds.length) return;
var mcl = new MovieClipLoader();
var lis = {};
mcl.addListener(lis);
lis.onLoadInit = function(target) {
target._width = Width;
target._height = Height;
}
mcl.loadClip(
Backgrounds[Math.floor(Math.random()*Backgrounds.length)],
Image
);
}
|