AS3 Loading XML And Display On Stage
I haven't done much with AS3 .. just simple Flex stuff, but I have to load XML from an external URL and discovered this was much easier to get what I needed with AS3. My problem is the XML loads and I can trace till the cows come home, but I can't get the code right to display the information on the stage.Here is the loading code:import flash.net.*;import flash.events.*;import flash.display.*;import flash.geom.*;import flash.ui.*;import flash.utils.*;import flash.text.*;var xmlLoader:URLLoader = new URLLoader();var xmlData:XML = new XML();xmlLoader.addEventListener(Event.COMPLETE, LoadXML);xmlLoader.load(new URLRequest("externalURLremoved"));function LoadXML(e:Event):void {xmlData = new XML(e.target.data);ParseWeather(xmlData);}function ParseWeather(weatherInput:XML):void {trace("XML Output");trace("------------------------");var weatherChildren:XMLList = weatherInput.cc.children();for each (var info:XML in weatherChildren) {trace(info);}}All the data displays in the output window perfectly. But I need to display values from the XML on the stage. With AS2, I would have used the variable box in the property inspector, but of course, this doesn't work in AS3. I can display text values like this:var input_txt:TextField = new TextField();input_txt.x = 105;input_txt.y = 35;input_txt.width = 530;input_txt.height = 156;addChild(input_txt);input_txt.text = "Hello World";but I can't figure out how to substitute a value from the XML for the text. All the sample I have found for loading XML stop with the trace statement in the output window. I haven't found any that take that through to the stage and I have looked online for hours and in every book that I have.I thought it would be something likeinput_txt.text=(info.tmp);but that throws errors. Everything I have tried throws errors.Any advice?Thanks!Nancy
Adobe > ActionScript 1 and 2
Posted on: 09/15/2007 05:09:01 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
No Display On Stage Using AS 3.0
Hi All,
I am pretty new to AS3. I have written below code to display a circle on stage.
Code:
package {
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.*;
public class DisplayListExample extends MovieClip {
var circle:MovieClip=new MovieClip();
public function DisplayListExample() {
trace("Display");
var circle:MovieClip=new MovieClip();
circle.graphics.beginFill(0x00000000);
circle.graphics.lineStyle(1, 0x000000);
circle.graphics.drawCircle(100,100,100);
circle.graphics.endFill();
addChild(circle);
}
}
}
code in first frame of fla
Code:
var dl:DisplayListExample =new DisplayListExample();
This code should be drawing a circle on the stage whereas I do not see any things. How do I correct it.
Code works fine if they are placed in first frame of the fla after removing custom class structure.
Thanks in advance!!
How To Display Only The Stage
Whenever i veiw my flash animtaion in a web browser, everything around the stage still shows, how can i display only the stage?
Xml Display In Top Center Of Stage.
Hi! im studying and one of my missions is to keep my xml displaying in the top center all the time, even when browser resized now i cant for some reson get it to do that please any help will be appreciated.
(teacher gave us this fla to play around with).
thanks for looking
Quote:
// Stage variables
Stage.scaleMode = "noScale";
Stage.align = "T";
myXML = new XML();
myXML.onLoad = DisplayData;
myXML.load("demoText.xml");
function DisplayData(success)
{
if (success) {
xmlOutput = this.body.childnodes.join('').split('<a ').join('<font color="#666666"><u><a target="_blank" ').split('</a>').join('</a></u></font>');
}
}
Xml Display In Top Center Of Stage.
Hi! im studying and one of my missions is to keep my xml displaying in the top center all the time, even when browser resized now i cant for some reson get it to do that please any help will be appreciated.
(teacher gave us this fla to play around with).
thanks for looking
Quote:
// Stage variables
Stage.scaleMode = "noScale";
Stage.align = "T";
myXML = new XML();
myXML.onLoad = DisplayData;
myXML.load("demoText.xml");
function DisplayData(success)
{
if (success) {
xmlOutput = this.body.childnodes.join('').split('<a ').join('<font color="#666666"><u><a target="_blank" ').split('</a>').join('</a></u></font>');
}
}
Text Will Not Display On Stage?
I created a symbol and typed some text and dragged it to my stage. When I perform a control>test movie, it does not display.
The text symbol also has a long black rectangle around it when not selected and a blue one when selected. Why does it not display?
Thanks.
Display Stage At Fullscreen
I have 2 buttons that enable me to display FLV's at normal and full screen that works.
Is there a way of stopping - press escape to exit full screen displaying?
or is there a way of adding additional functions to a listener when ESCAPE has been pressed?
Code:
ar keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.ESCAPE)) {
//add extra functions here so that the video is placed to the correct coordinates when escape has been pressed
my_video._x = 11.6;
my_video._y = 36.0;
my_video._width = 375.3;
my_video._height = 281.5;
}
};
Key.addListener(keyListener);
Cs3 Flash.display.stage Could Not Be Found
Hi everyone. Im new to this forum.
I got a magazine with a tutorial about making a 3d menu bar with papervision. I did the tutorial installed everything like it asked and when i hit the CTRL + ENTER button i got this warning back at me
"1172: Definition flash.display.stage could not be found."
I tried find something with google but nothing.... and ideas anyone
Or is the problem related to where the clases folder is. Not sure though
Display Output In TextField On The Stage
Is possible to display all the information in the Output folder into a textField on the stage ?
I need to debug after publishing and I can't replace each single "trace" functon.
Accessing Display Objects Via The Stage Var
I'm passing a stage reference to my class, but when I try to access a movieclip on the stage I get an error.
this gives me an error:
var mc = targetStage.myMovieClip;
Thanks!
Attach Code
package {
import flash.display.Stage;
import flash.display.MovieClip;
public class MyClass {
private var targetStage:Stage;
public function MyClass ( aStage:Stage) {
targetStage = aStage;
var mc = targetStage.myMovieClip;
}
}
}
Dynamically Size Stage And Display Area?
I have a slideshow that loads from xml and fades in a variety of sizes of images in random positions. I'm trying to set it up so that the swf (which is in a div tag in an interface) will resize depending on the browser size and will use the NEW stage size to determine the random x/y positions of the images (without resizing them) and will skip any images that are too big for the stage size...
Any ideas if this is possible? Dynamically sizing and determining the "working area" of a swf based on the browser/div size??
THANKS!!!!
Class Variable Main Stage Display Help/advice
Hi there,
I recently bought MX 2004 Professional after being on flash 5 for ages and Im liking the jump so far.
I was looking for tutorials on the internet regarding making classes and displaying the data to the screen.
I found a tute that showed me how to make the class file [Product.as] seperate to the actual FLA file that retains the data, the problem is I cant work out how to display the variable data in the fla file.
the example tute i followed showed how to pipe it to the output but not into textual components on screen
Ive dabbled in other OOP languages so I understand the principles and the example below works but the output to the main stage screen is what im not sure how to achieve. I made a text box dynamic and called the variable Product_1.UID but it didnt display anything.
Quote:
// ------------
// This Class Defines the variables for the products in the shopping cart
// ------------
class Product {
// Declare Variables
var UID:Number;
var Name:String;
var Description:String;
var Price:Number;
// Constructor function
function Product (myUID:Number, myName:String, myDescription:String, myPrice:Number) {
this.UID = myUID;
this.Name = myName;
this.Description = myDescription;
this.Price = myPrice;
}
// Method to return property values
function getInfo():String {
return("Product:" + this.UID + " | " + this.Name + " | " + this.Description + " | " + this.Price);
}
}
and the data in the fla is here
Quote:
// assumes FLA and AS class file are in same directory
var Product_1:Product = new Product(1, "Widget", "A Fine Widget indeed", 12.34 );
var Product_2:Product = new Product(2, "Sprocket", "A Fine Product indeed", 222.34 );
var Product_3:Product = new Product(3, "Thingy", "A Fine Product indeed", 42.34 );
var Product_4:Product = new Product(4, "Whatsit", "A very good one at that", 52.34 );
var Product_5:Product = new Product(5, "That thing", "A Fine Product indeed", 622.34 );
var Product_6:Product = new Product(6, "nerfball", "A Great Braindead thing", 72.34 );
var Product_7:Product = new Product(7, "blogget", "A Fine Product indeed", 82.34 );
var Product_8:Product = new Product(8, "blammit", "A Fine Product indeed", 92.34 );
var Product_9:Product = new Product(9, "blabla", "A Fine Product indeed", 222.34 );
var Product_10:Product = new Product(10, "mojo", "A Fine Specimen indeed", 122.34 );
trace(Product_1.getInfo());
trace(Product_2.getInfo());
trace(Product_3.getInfo());
trace(Product_4.getInfo());
trace(Product_5.getInfo());
trace(Product_6.getInfo());
trace(Product_7.getInfo());
trace(Product_8.getInfo());
trace(Product_9.getInfo());
trace(Product_10.getInfo());
Display Random Text On Stage, Floating Across Randomly
Hi
Can anyone help with a script for doing the following.
I would like to have a box where random sentances from a text file would move across at different trajectories, speeds, colors and sizes. Having more than one in view at any one time.
The application is for a musical group, we want to put our song list into a text file, then use the script to display the contents in random order. We have over 400 songs so doing this in a list would be boring.
I only have basic knowledge of Flash (using Flash MX). Im a PHP programmer.
Any ideas
Thanks Terry
Difficulty Trying To Load Image Via Binary Socket And Then Display On Stage
Hi all,
Hopefully someone can help. I'm trying to connect to a Java socket server on another pc on my network via a binary socket in AS3. I would like to be able to download an image from the java server and display it in a Flash CS3 movie. I have managed so far to get the socket to connect to my java server and download the raw byte data of the image.
What I am struggling with is getting the AS3 script to know that it is the end of the file and then display the image in the stage. I know that there is an Event.COMPLETE event for URL Loaders, but do not know how to implement this for a binary socket. You will see from my code that I have tried to send a byte array of "FIN" when the image has finished sending, but cannot get the client to recognise this. Anyone any ideas?
Here is my code so far:
Code:
var s:Socket = new Socket("PHOENIX", 31742);
var imgData:ByteArray = new ByteArray();
var imgStream:URLStream = new URLStream();
var loader:Loader = new Loader() ;
s.addEventListener( ProgressEvent.SOCKET_DATA , imageStreamProgress );
s.writeUTF("file");
s.flush();
trace("file requested");
function imageStreamProgress( event:Event ):void
{
// if there are no bytes do nothing
if( s.bytesAvailable == 0 ) return
// ooo bytes process the image data
trace(s.bytesAvailable);
this.processImageData();
}
function imageStreamComplete():void
{
// if connected, stop that.
if ( s.connected ) s.close();
// lets refresh the displayList after rendering cycle
//imageCanvas.callLater( this.processImageData );
trace("FIN");
trace(s.bytesAvailable);
}
function processImageData():void
{
// if connected, read all the bytes that have been loaded into the aggregate bytearray
if ( s.connected ) s.readBytes( imgData , imgData.length );
var test:String = imgData.toString();
trace (test);
if (test.indexOf("FIN") != 0) {
// clean out all the crud in that loader
loader.unload();
//push the aggregate bytearray of loaded image data in there.
loader.loadBytes( imgData );
} else {
imageStreamComplete();
}
}
MC's Within MC's Different Behaviour Betewen AS-loading And Stage Loading?
Sorry about the too long topic title, but it sort of got even more incomprehensible when I made it shorter.
Now, on to the problem:
I've got a movie clip that consists of a few other movie clips. This is to maintain a certain degree of order in the chaos.
I use action script to load the container mc on the stage. Now I want to change some properties of on of the contained mc's, but they seem to be unreachable.
So I did a little testing and I found out that when you just place an instance on the stage, those contained MC's are accesable, you can see in the debugger that the container MC contains other stuff.
But if the MC is loaded with attachMovie(), the debugger does not show that the container has other mc's within it, and therefor I cannot change the properties of those mc's.
Any thoughts about how I can solve this problem?
PS. Of course I can give up this ordering business and just attach multiple movies. Although this circumvents the problem, I would prefer not to do this because:
1. I'd like to stick to the 'certain degree of order'.
2. I wish to learn how this works.
1034: Type Coercion Failed: Cannot Convert Flash.display::Stage@1c4d9461 To Flash.dis
new to AS3 and working with classes (would consider myself knowledgeable enough in AS2 to be dangerous) and am encountering all kinds of migraine inducing fun while trying to make the leap to AS3.
latest is trying to reference the main timeline from within my class.
i am trying to reference it like this:
Code:
var home:MovieClip = MovieClip(this.parent); // variable handle referring to _root timeline
and getting this error(s):
Quote:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@1c4d9461 to flash.display.MovieClip.
at Carousel()
Error: Error #2136: The SWF file file:///Macintosh%20HD/Users/Nate/Desktop/Flash%20%2D%20Learning/Lee%20Brimelow/with%20Classes/MainCarousel.swf contains invalid data.
at Carousel/frame1()
I believe the first error is that i cannot cast the _root timeline as a movieclip for some reason and am really starting to wonder why the Display List is such a pain to work with (or appears to be a pain anyway).
sure would be nice to have a way to reference the stage and clips on it without having to write extra code or chew my own lips off. grrrr!! The second error isn't even on my radar yet although it looks like a doozy.
Scripting Picture Loading/display
Is it possible to call a script from a flash button that can display a photograph in a new window that is automatically sized to the dimentions of the photo?
Any samples out there that might help?
-mojo
Display Streaming/loading Status?
SITUATION:
I have a simple movie (loeaderTest.fla, attached) that is loaded into my main movie via loadMovie(). It's about 450 frames/<300Kb and consists only of some images put together for a project.
I was considering a preloader to wait for the whole movie to load, but it seems a bit of a waist here, since the movie starts to play once the first picture is loaded. Then there are a few seconds of "pause" for some of the pictures to come. This is not a big problem, but I want to display to the user when he is waiting for content to load and not..
WHAT I WANT:
I want a "loading" thing to appear when the playhead has stopped to wait for the next part to load! (..so that it can continue..)
To better understand please open the attached FLA and preview it in flash with the downloadsetting set to 56K.. The playhead stands still at the beginning, around 40 and 85...
Anyone have an idea on how to accomplish this??
Please help!
THANKS!
How Can I Load A Photo With A Little Loading Display Before That...
how can i load a photo with a little loading display before that...
i've tried to add a loading display one keyframe before the actual photo... it works but the reaction of the loading is not good. and its efficiency is far away from those fashion site out there (e.g. www.ysl.com)
my code is as below:
// set variable
ready = Math.ceil(_parent.getBytesLoaded()/_parent.getBytesTotal()*100);
// show how many percent left to load
if (showPercent<100) {
showPercent = ready+"%";
} else {
showPercent = "loaded!";
}
// show how many size left to load
showSize = "("+(Math.ceil(_parent.getBytesTotal()/1024))+"kb)";
// loader aniimation
loader.gotoAndPlay(ready);
if (ready == 100) {
_root.play();
}
How Can I Load A Photo With A Little Loading Display Before That...
how can i load a photo with a little loading display before that...
i've tried to add a loading display one keyframe before the actual photo... it works but the reaction of the loading is not good. and its efficiency is far away from those fashion site out there (e.g. www.ysl.com)
my code is as below:
// set variable
ready = Math.ceil(_parent.getBytesLoaded()/_parent.getBytesTotal()*100);
// show how many percent left to load
if (showPercent<100) {
showPercent = ready+"%";
} else {
showPercent = "loaded!";
}
// show how many size left to load
showSize = "("+(Math.ceil(_parent.getBytesTotal()/1024))+"kb)";
// loader aniimation
loader.gotoAndPlay(ready);
if (ready == 100) {
_root.play();
}
How Can I Load A Photo With A Little Loading Display Before That...
how can i load a photo with a little loading display before that...
i've tried to add a loading display one keyframe before the actual photo... it works but the reaction of the loading is not good. and its efficiency is far away from those fashion site out there (e.g. www.ysl.com)
my code is as below:
// set variable
ready = Math.ceil(_parent.getBytesLoaded()/_parent.getBytesTotal()*100);
// show how many percent left to load
if (showPercent<100) {
showPercent = ready+"%";
} else {
showPercent = "loaded!";
}
// show how many size left to load
showSize = "("+(Math.ceil(_parent.getBytesTotal()/1024))+"kb)";
// loader aniimation
loader.gotoAndPlay(ready);
if (ready == 100) {
_root.play();
}
Display Error While Loading XML File
Hi
Im currently workin on game and the track for my object is loaded in by an xml file.
On first load of game following the intro the main game is initialised and these xml files loaded but then when it displays the game everything works but the track is not displayed.
If i rewind the movie to first menu again and go through all the option again the game works as it did before but the track is now displayed as well.
Any ideas why the track might not be displaying first time round?
Cheers
Dave
How Can I Load A Photo With A Little Loading Display Before That...
how can i load a photo with a little loading display before that...
i've tried to add a loading display one keyframe before the actual photo... it works but the reaction of the loading is not good. and its efficiency is far away from those fashion site out there (e.g. www.ysl.com)
my code is as below:
ActionScript Code:
// set variable
ready = Math.ceil(_parent.getBytesLoaded()/_parent.getBytesTotal()*100);
// show how many percent left to load
if (showPercent<100) {
showPercent = ready+"%";
} else {
showPercent = "loaded!";
}
// show how many size left to load
showSize = "("+(Math.ceil(_parent.getBytesTotal()/1024))+"kb)";
// loader aniimation
loader.gotoAndPlay(ready);
if (ready == 100) {
_root.play();
};
_______
How Can I Load A Photo With A Little Loading Display Before That...
how can i load a photo with a little loading display before that...
i've tried to add a loading display one keyframe before the actual photo... it works but the reaction of the loading is not good. and its efficiency is far away from those fashion site out there (e.g. www.ysl.com)
my code is as below:
ActionScript Code:
// set variable
ready = Math.ceil(_parent.getBytesLoaded()/_parent.getBytesTotal()*100);
// show how many percent left to load
if (showPercent<100) {
showPercent = ready+"%";
} else {
showPercent = "loaded!";
}
// show how many size left to load
showSize = "("+(Math.ceil(_parent.getBytesTotal()/1024))+"kb)";
// loader aniimation
loader.gotoAndPlay(ready);
if (ready == 100) {
_root.play();
};
Text Field To Display % Loading ?
Hi
im using the version 8 of flash Pro.
I have this script for my preloader bar which works fine.
How i can add a text field/box so it can display the % percentage loaded ?
Code:
var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);
myListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
var loaded:Number = Math.round((bytesLoaded/bytesTotal) * 100);
progressBar.gotoAndStop(loaded);
}
myListener.onLoadInit = function (target_mc:MovieClip) {
progressBar._visible = false;
}
myListener.onLoadStart = function (target_mc:MovieClip) {
progressBar._visible = true;
}
myMCL.loadClip("main_movie.swf","container");
Display The Value Of The Buffer When A Video Is Loading
Hi
Thx for your forum
I have a little problem with this code
I wish to display the number of Kbits loaded in the buffer when the video playing
I use this AS code to load these video on flash but I wish to show this information near my video
Can you help me please
Thx
Code:
med.setMedia("video2.flv");
var monEcouteur = new Object();
monEcouteur.complete = function(objetEvt) {
trace(med.contentPath+" est termin?");
med.play(0);
};
med.addEventListener("complete", monEcouteur);
_ns.onMetaData = function(obj) {
temps = obj.duration;
trace("FLV duration: "+obj.duration+" secondes");
};
_video.attachVideo(_ns);
_ns.play("video2.flv");
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.play("video2.flv");
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 260;
loader.scrub._x = ns.time / duration * 260;
}
Code For Percentage Display Of Loading Own Content
I need to build an AS3 code for an external AS file that would provide the percentage of loading the content of its own swf ( library assets, etc ) and not external files. And then, after the loading is complete, it should add an instance of the main MovieClip ( from the library) into the stage.
( So far I only found code for preloading an external swf)
Any idea ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
I already have a code that goes embedded in the first frame of a fla file and it works. The fla has two scenes, one called “preloader” and the other just “scene”.
In the “preloader” scene I have this code in the first frame:
import flash.events.ProgressEvent;
function LoadingProgress(e: ProgressEvent):void
{
var percent:Number = Math.floor( (e.bytesLoaded*100)/e.bytesTotal );
t.text = ""+percent;
if(percent == 100)
{
play();
}
}
loaderInfo.addEventListener(ProgressEvent.PROGRESS , LoadingProgres);
stop();
It also has an instance of an animation movieclip in the stage that shows the loading progress.
And in the “scene” scene it has a simple instruction as code in the first frame:
stop();
And it also has an instance of the main movieclip on the stage.
It works fine, but my version of a separated AS file ( using package/class ) is not working.
Display Loading Progress For Multiple Images/swf
hello,
is it possible to display the loading progress of an arbitrary number of images/swfs in only one loader?, i'm attaching some buttons using actionscript and each button have a different background image, the images are loaded dynamically because they may change, the number of buttons may change too, so i want to display a loader for the total download progress but i'm not sure how to do that
thanks for your help
Loading Client-side Display Assets
Can I load and display images from the client's machine, without first loading them to a server? The user should be able to choose the image file, through the use of FileReference I assume.
Code For Percentage Display Of Loading Own Content
I need an AS3 code for an external AS file that would provide the percentage of loading the content of its own swf ( library assets, etc ) and NOT external files. And then, after the loading is complete, it should add an instance of the main MovieClip ( from the library) into the stage.
( So far I only found code for preloading an external swf)
Any idea ?
Limits On Loading External Display Assets
I ran into a limit on loading external images. If their are too many images in the target location, there is a time out. I think.
Did I read somewhere that if the asset is not loaded within a given period of time, the attempt will time out?
Is there a way to increase this limit?
Code For Percentage Display Of Loading Own Content
I need an AS3 code in an external AS file that would provide the percentage of content loading of its own swf ( library assets, etc ) and not external files. And then, after the loading is complete, it should add an instance of the main MovieClip ( from the library) into the stage.
( So far I only found code for preloading an external swf)
Any idea ?
Code For Percentage Display Of Loading Own Content
I need an AS3 code for an external AS file that would provide the percentage of loading the content of its own swf
( library assets, etc ) and not external files. And then, after the loading is complete, it should add an instance of the main MovieClip ( from the library) into the stage.
( So far I only found code for preloading an external swf)
Any idea ?
Best Way To Display "Loading" When Your Dynamic Soundfile Is Loading
Hello,
Im working on a player (mp3) and I have it loading and playing properly and all. Now what I want to do is while the sound object is downloading the mp3 for a dynamic text box to say "loading" or something like that.
or better yet, if I can get the progress bar to progress while it downloads.
What would be the best way to accomplish this? I have searched the web and all, but all I see the use of the progress bar (MX 2004 Pro) for like pictures and swf.
Thanks,
Cedric
Soun And Display Problem When Loading Multiple Movies
I have a project wich working as follow
1-a movie Characters.swf that have 36 buttons wich have
a-an event sound attached to over frame
b-other event sound attached to down frame
when clicking (On release) the button it load movie wich name is 1.swf and godjag.swf
on (release) {
unloadMovieNum(0);
loadMovieNum("1.swf", 0);
loadMovieNum("godjag.swf", 3);
}
evrey button have corrisponde swf 1.swf,2.swf,3.swf...
the godjag.swf have a one button
with the event
on (release) {
loadMovieNum("Character.swf", 0);
unloadMovieNum(3);
}
THE PROBLEM IS that somtime the 1.swf,2.swf.. which begins with a stream sound (approx. 1 minuth) begins to crack and the clips became so slow and after all its stop and the sound desappear, this not happens evrey time it hapanes somtimes rarley and somtime offtenlly.
CAN YOU HELP ME
Loading Percentage Doesn't Display In Stand Alone Player
Hi,
I have a loading sequence that supposes to load an external .swf to a main. swf file and display the loaded percentage on screen. It works properly when the main.swf file is embedded in a web page and view through a browser. However, when I save it as a .exe file and run it from a CDrom (which is what I develop the presentation for), the loaded percentage doesn't display, it just freezes at the original stage but the external.swf file is actually loading, the movie then jump to play the external.swf file once it finished loading.
The external .swf file embedded an avi movie so it's about 50m in size, and it can take upto a minute (ie. screen freeze for a minute) to download(?) from the CDrom before it is viewable from an older PC.
Has anyone experience similar situation before? And know how to solve the problem?
Here is the script (I copy it from Flashkit Tutorial) for the loading sequence:
onClipEvent (enterFrame) {
if (_root.loadingsequence == true && this.percent == null) {
loadMovie("movies/intro01.swf", _root.corner);
_root.corner._alpha = 0;
this.percent = 0;
}
if (_root.loadingsequence == true && _root.corner.getBytesTotal()> 10) {
this.percent = (_root.corner.getBytesLoaded()/_root.corner.getBytesTotal()*100);
_root.loadingtext = Math.floor(this.percent);
_root.loadingbar._width = 250-(this.percent*2.50);
if (this.percent == 100) {
_root.corner._alpha = 100;
_root.loadingsequence = false;
}
}
}
Thanks in advance for any help.
Loading Different Text Files Using Buttons To Display In One Content Box
Hello,
I am a newbie on the forum as well as to Flash and as expected I,m already into problems. I have over 20 buttons with over 20 frames in my movie. I want each button, when clicked, to got to a required frame and then load text dynamically from an extrernal file, displaying it in the same content box. I have tried loads of technics but dont seem to get it working. Please help!!
Here is the code attached to one of my buttons:
on (release) {
gotoAndstop ("home");
loadText = new LoadVars();
loadText.load("myhome.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
scroller_text.html = true;
scroller_text.htmlText = this.mypage1;
}
};
}
With the above code I am able to go to the home page at the click of the button "home" but text from "myhome.txt" does not load. Please help!
Thanks.
Loading Swf On Main Stage
I have my menu in a mc. I want it to load a swf into the main stage area. Also I would need it to unload the previous swf everytime a new button is pressed. How owuld I go about doing that.
Loading In A Swf- And The Main Stage
Hello, I have a swf loading into my main movie. In the swf I have movie and at the last key frame I have it tell target / go to frame a and stop. The swf alone works fine, but when I load it into the movie it does not work. I am assuming that / goes to the main movie stage rather then the main stage of the swf. How can I get it to go to the main stage of the swf. thanks in advance- Dave
Loading .swf Movies Into Stage
Hello good day!
I'm using Flash MX 2004 Professional and I'm wondering how can I load several ready made .swf movies so that I can join them together to form a bigger movie clip? I've tried the File - Import to import .swf movies to the stage but when I test the movie, it just won't play. Please help! Thanks
Loading Movie On To Stage
I'm trying to load a movie on to my stage (main) but I am having trouble positioning it where I want it. I've tried the target clip, but I lose some of my animation when I do this (the fuzz in the movie)
I also only have this 250 x 100; kind of like a pan up shot of the woman but it is showing everything; even what is off the stage?????Site
Loading SWF To Main Stage?
I have 3 seperate swf files one is the main movie and the other are a audio file saved as a swf and another is a image with animations. So I want to load the main movie first then load the audio and next the image with animations one right after another but not at the same time. How would I go about doing this best?
Loading A Jpg So It Is Already On Stage When You Go To The Page
I have a image gallery on a page on my site. Presently when you gotoAndPlay ("image gallery"); the page slides on to the screen and the thumbnails fade up, but you have to click a thumbnail before a jpg is loaded, so the page looks like it's coming up blank in the main image area.
Is there a way you can specify a jpeg to be already loaded so that when you go to the page it has an image already there. it doesn't really matter which one it is.
Thanks, in anticipation
Peter
Loading Mc Symbols To Stage
Hi, I have some actionscript that loads a movieclip symbol to the stage and positions it as so.
function DisplayContent() {
var newMovie:intro_info = new intro_info();
newMovie.x = 400;
newMovie.y = 315;
this.addChild(newMovie);
}
DisplayContent();
I would like to set up a button that loads a new mc symbol which will replace the symbol that has already been loaded from the script I have posted above. Can anyone help as I am still very much learning AS3 and my head is starting to hurt
.swf Files Are Not Loading Into The Stage
The way my portfolio is now, is on my homepage link. My plan is to improve it by having the clips load within a blank movie clip, and a button to the left serves to bring the viewer back to the menu.
So the strategy is: the viewer clicks on the button (5 buttons on frame 85, layers 8 through 10). The timeline plays to the last frame, 91 layer 11 to enable a swish effect for the button. The selected .swf plays here.
Here is the button code:
Code:
on(release){
_root.gotoAndPlay(85);
//starting with the first button. we create a screening window -
_root.createEmptyMovieClip(screen, 11);
//some stuff about screen._x and _y to be done later. screen is now the _parent
_parent.attachMovie("dracula.swf", this);
_parent.play();
}
That didn't work. I'm using MX pre-2004 so that might cause some issues. Won't you help a starving Flash dev make his portfolio not suck? I appreciate any help here!
[F8] Loading MC From Library To Stage
Hi,
How do I load an MC I have in my library onto the stage and to a certain spot (x and y coordinates would be provided when loading the MC).
Cheers,
Chris
Stage Height On Loading Swf Into Another
Hi,
I am sure this is a common issue and hopefully there is a solution:
If I load an swf into another swf is there a way of getting the stage height of the child moviclip.
I know the loaded movieclip stage will be the same as the parents (i.e. I know there is only one stage)
So what I need is a way of setting a variable in the child swf when it is published based on the height of the childs stage that can be accessed but will not be changed by the parent.
Does this make sense? I am looking for the most simple solution possible - I am aware I could make transparent MCs and get the height but this means I would have to resize this mc every time I need to adjust the childs stage height.
Any help/ideas appreciated.
pw
Loading A Jpg And Placing It On The Stage Twice
I am trying to import an image and then place the image in two spots on the stage. This is the code I'm using:
ActionScript Code:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingDone);
var request:URLRequest = new URLRequest("sam.jpg");
loader.load(request);
function loadingDone(event:Event):void {
// get loaded data
var image:Bitmap = Bitmap(event.target.loader.content);
// create new sprite and add bitmap data to it
var newPiece:Sprite = new Sprite();
newPiece.addChild(image);
// add to stage
addChild(newPiece);
var newPiece2:Sprite = new Sprite();
newPiece2.addChild(image);
// add to stage
addChild(newPiece2);
newPiece2.x = 300;
}
My problem is rather than placing two instances of the image on the stage, the code above places one image with an x coordinate of 300 and a y coordinate of 0.
I thought the code above would place two images. One at point (0,0) and the other at point (300,0).
Any thoughts?
|