Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Load External .swf Then Return



I am loading an external .swf (slideshow)inside of a projector project and it is working fine. What I would like to do is at anytime during the slideshow a button can be pushed and return to the original movie but I am not sure how.

Thanks in advance



FlashKit > Flash Help > Flash ActionScript
Posted on: 12-08-2004, 07:26 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Load External Xml File - Return Problem
package { import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class xml { public var myXML:XML;

public function loadXML(url:String):XML { var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, readXML);
loader.load(new URLRequest(url));

return myXML; // return null
}

public function readXML(e:Event):void {myXML = new XML(e.target.data);
trace(myXML); // xml ok
}
}
}

-------
I want to say trace(new xml().loadXML('test.xml'));
But return has no value. I want wait until you get the String and ONLY THEN return it..

Help with this problem..Thks

Return Command And XML Load
hello!
ive got a small problem.This is the piece of code:

//---[ get the filenames for all the 5 kind of images
_global.getImagesName = function(id_prodotto) {
var images_xml:XML = new XML();
images_xml.onLoad = function() {
//-------[ temporary creation of the Object will hold the details of the product we need
var names_obj = new Object();
//-------[ start the cicle "for"
for (var i = 0; i < this.firstChild.childNodes.length; i++) {
//-------[
switch (this.firstChild.childNodes[i].attributes.TipoAllegato) {
case "4" :
names_obj.preview = this.firstChild.childNodes[i].attributes.NomeFile;
break;
case "3" :
names_obj.normal = this.firstChild.childNodes[i].attributes.NomeFile;
break;
case "2" :
names_obj.zoom = this.firstChild.childNodes[i].attributes.NomeFile;
break;
case "5" :
names_obj.tech = this.firstChild.childNodes[i].attributes.NomeFile;
break;
}
}
//-------[ return the obj fully loaded with the details of the product
return names_obj;
};
//-------[ load the external XML
images_xml.load("http://intranet.remedia.it/franke2006/datapump/Query.ashx?What=GetImageByProdotto&IdProdotto=" + id_prodotto);
};

//-------[ set the object to get all the names for the 4 type of the image of the product
var img_obj:Object = getImagesName(productInfo_obj.id_prodotto);


ok,the small problem,as u can see is that I have to reference the img_obj ONLY when all the datas has fully loaded, but the return command doesnt seems to works.
Where is the "catch"?

tnx

Can LoadVars() Load The Return Value From..
Hi,

Can LoadVars() load a returned value from web service. do we have to set any values to access the data from web service.


Thanks

LoadVars.Load Won't Return Variable
I am 16 hours into frustration.

When you see the code it will be pretty self-explanatory. It's a typical form and db. When the user presses the submit button the database does populate but after that I can't get the ASP to send the blnFailed back to the flash file so that I can send the user to the appropriate page. The variable blnFailed is always coming back as 'undefinded'. I'm so tired and mad. It's like, everything works until it goes to pass me back that variable.

I really hope you can help. Thank you.

Selfminded

The Actionscript is as follows:

__________________________________________________ _______________

function checkFailed(){
if(db.blnFailed == 0) {
_parent._parent.gotoAndStop(2);
}else if(db.blnFailed==1){
_parent._parent.gotoAndStop(3);
}else{
stop();
}
}

function submitFormS(){
var alertString = "";
var checkString = txtSName.text;
var theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Name field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Name field. ";
}
checkString = txtSTitle.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Title field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Title field. ";
}
checkString = txtSDistrict.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in District field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in District field. ";
}
checkString = txtSAddress.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Address field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Address field. ";
}
checkString = txtSPhone.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Phone field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Phone field. ";
}
checkString = txtSEmail.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Email field.";
} else {
if (theProblem != -1){
alertString = alertString + "<br>' in Email field. ";
} else {
theProblem = checkString.indexOf("@");
if (theProblem == -1) {
alertString = alertString + "<br>Invalid email address in Email field."
}
}
}
checkString = txtSFourth.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Fourth grade field.";
} else {
if (isNaN(checkString)) {
alertString = alertString + "<br>Fourth grade field should only contain numbers.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Fourth grade field. ";
}
}
checkString = txtSSixth.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Sixth grade field.";
} else {
if (isNaN(checkString)) {
alertString = alertString + "<br>Sixth grade field should only contain numbers.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Sixth grade field. ";
}
}
checkString = txtSTenth.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Tenth grade field.";
} else {
if (isNaN(checkString)) {
alertString = alertString + "<br>Tenth grade field should only contain numbers.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Tenth grade field.";
}
}
if (alertString != "") {
alertString = "The following errors have occured:<br>" + alertString;
_parent._parent.clipAlert.alertString = alertString;
_parent._parent.clipAlert.gotoAndStop(2);
} else {
dbURL = "flashsdb.asp"; // I use the absolute path here, insert your own
db = new LoadVars();

var strName = txtSName.text;
var strTitle = txtSTitle.text;
var strDistrict = txtSDistrict.text;
var strAddress = txtSAddress.text;
var strPhone = txtSPhone.text;
var strEmail = txtSEmail.text;
var strFourth = txtSFourth.text;
var strSixth = txtSSixth.text;
var strTenth = txtSTenth.text;

db.onLoad = checkFailed();
db.load(dbURL+"?strName="+strName+"&strTitle="+str Title+"&strDistrict="+strDistrict+"&strAddress="+s trAddress+"&strPhone="+strPhone+"&strEmail="+strEm ail+"&strFourth="+strFourth+"&strSixth="+strSixth+ "&strTenth="+strTenth);

}
}

function clearFormS(){
txtSName.text = "";
txtSTitle.text = "";
txtSDistrict.text = "";
txtSPhone.text = "";
txtSEmail.text = "";
txtSAddress.text = "";
txtSFourth.text = "";
txtSSixth.text = "";
txtSTenth.text = "";
}

function submitFormO(){
}

function clearFormO(){
txtOName.text = "";
txtOPhone.text = "";
txtOEmail.text = "";
txtOAddress.text = "";
txtOProposed.text = "";

}

__________________________________________________ _______________

Here's the ASP Code that goes with it:
__________________________________________________ _______________

<%@ language="VBscript"%>
<%
Option Explicit
Dim objConn, checkSQL, blnFailed
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DB"

Set checkSQL = objConn.Execute("SELECT Email FROM School WHERE Email = '" & Trim(Ucase(request("strEmail"))) & "'")

If checkSQL.EOF Then
objConn.Execute("INSERT INTO School(Name, Title, District, Address, Phone, Email, Fourth, Sixth, Tenth) VALUES('" & Trim(Ucase(Request("strName"))) & "', '" & Trim(Ucase(Request("strTitle"))) & "', '" & Trim(Ucase(Request("strDistrict"))) & "', '" & Trim(Ucase(Request("strAddress"))) & "', '" & Trim(Ucase(Request("strPhone"))) & "', '" & Trim(Ucase(Request("strEmail"))) & "', '" & Trim(Ucase(Request("strFourth"))) & "', '" & Trim(Ucase(Request("strSixth"))) & "', '" & Trim(Ucase(Request("strTenth"))) & "')")
objConn.Close
Set objConn = Nothing
blnFailed = "blnFailed=0"
Else
objConn.Close
Set objConn = Nothing
blnFailed = "blnFailed=1"
End If

response.write blnFailed
%>

Load Movie, Then Return To Main?
heya,

I have just learned to load external .swfs into a parent .swf using both the target and level methods...

one thing that stumps me though, that none of the tutorials suggest is this...

my parent .swf file is split into 6 scenes with a common nav with 6 icons to get to each scene. The external .swf is an animation that is pulled in when in the animation section, but you can still see the common nav from the parent file while viewing the child .swf.

If I use the nav, it works, but the child .swf file continues to play over top of these scenes and does not go away.

So how do I kill it? or just return to my _parent .swf so it looks seamless just as if it is a scene in the parent movie?

cheers!

How Do I Return A Value If The Function Calls A Load()
Hey guys,

I am writing a function that I would like to ping a web service, which sends back JSON data, then return data from the JSON...

i.e. trace(getJSONData(1234));

How can I get it to WAIT until the data is loaded then return what I want?

Right now I have this to get the JSON data in:


Code:
articleFeedRequest.url = "http://url_to_go_to.tv/rpc/get/feed(article_id_exact=" + articleNumber + ")" ; // get the data from the userNumbers feed.
articleFeedLoader.load(userFeedRequest);

articleFeedLoader.addEventListener(Event.COMPLETE, decodeJSON);
How can I package all this into a function itself so I can call the function in a trace or whatever to return the data I am looking for...without waiting for the Event.COMPLETE to trigger a new function. I want to have the same function grab the data AND return it.

Know what I mean?

Thanks a jig!

Load Movie, Then Return To Main?
heya,

I have just learned to load external .swfs into a parent .swf using both the target and level methods...

one thing that stumps me though, that none of the tutorials suggest is this...

my parent .swf file is split into 6 scenes with a common nav with 6 icons to get to each scene. The external .swf is an animation that is pulled in when in the animation section, but you can still see the common nav from the parent file while viewing the child .swf.

If I use the nav, it works, but the child .swf file continues to play over top of these scenes and does not go away.

So how do I kill it? or just return to my _parent .swf so it looks seamless just as if it is a scene in the parent movie?

cheers!

Load Movie, Then Return To Main?
heya,

I have just learned to load external .swfs into a parent .swf using both the target and level methods...

one thing that stumps me though, that none of the tutorials suggest is this...

my parent .swf file is split into 6 scenes with a common nav with 6 icons to get to each scene. The external .swf is an animation that is pulled in when in the animation section, but you can still see the common nav from the parent file while viewing the child .swf.

If I use the nav, it works, but the child .swf file continues to play over top of these scenes and does not go away.

So how do I kill it? or just return to my _parent .swf so it looks seamless just as if it is a scene in the parent movie?

cheers!

Load A Movie And Return When Finish
Hi,
I need to load a swf movie when i release a button.
So:
on (release) {
    loadMovie("\video\intro.swf",_root);
}

But when this movie finish I want to come back where I was before loading the movie.
How can i do this?
Thanks,

Load Variable Adds Extra Return... ?
Hi,

I am loading a variable into flash that normally has half as many returns (
) I don't know how this happens, but when it goes into flash, it adds extra returns... Does any one know how to remove all of either the
or the
chars?

I would need this to be an action script answer... I am stumped... I have tried and tried, but I may just be doing the wrong thing...

Thank you for any help you can give me!

Error When Trying To Use Class To Load And Return Xml Data...
New to AS3 and returning to OOP and very confused:

I'm trying to write and use a class to just load any xml data and pass that data back to any calling client code.

The class to load the xml works fine as far as loading the xml, but I'm confused about how to use the class, ie, how to call the xml data in the client code. Here's the class to load the xml:


Code:
package com.xml{
import flash.net.*;
import flash.events.Event;

public class XmlLoader{
private var path:String = new String();
private var xmlLoader:URLLoader = new URLLoader();
private var xmlData:XML = new XML();

public function XmlLoader(xmlFilePath:String) {
this.path = xmlFilePath;
this.xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
this.xmlLoader.load(new URLRequest(this.path));
}

private function LoadXML(e:Event) {
this.xmlData = new XML(e.target.data);
}

public function getXML():XML {
return this.xmlData;
}

}
}
Here's an example of a class in which I'm tyring to use the XmlLoader class:


Code:
package com.menu{
import flash.display.*;
import flash.net.*;
import flash.events.Event;
import com.xml.XmlLoader;

public class XmlMenu {
private var path:String;
private var loadedXML;
private var xmlData:XML;

public function XmlMenu(xmlFilePath:String = "menu.xml") {
this.path = xmlFilePath;
loadedXML = new XmlLoader(path);
this.xmlData = loadedXML.getXML();
trace(this.xmlData);

}
}
}
I'm instantiating the XmlMenu class on the root timeline of an .fla file like so:


Code:
import com.menu.XmlMenu;
var menu:XmlMenu = new XmlMenu();
At present, the trace() function in the above XmlMenu class returns empty. Previously I was getting an error: Type Coercion failed: cannot convert MC to XML. But now the trace() just returns blank...

Very confused...

Any advice? Thanks!

External Strings And Return Commands
So if anyone deals with strings in Flash, you should know that
tells it to go to a newline. But when externally importing a string into Flash using HTML, it literally takes the
and doesn't recognize it as a new string.

Also, Flash doesn't recognize external arrays and therefore does not join them into a string or work with the .toString command.

So how can I possibly import a string from HTML into the Flash and have it recognize new lines? Say my server held this string:

string = "Today's Date: 11-22-01
Hi There!"

Importing it outputs:
"Today's Date: 11-22-01
Hi There!"
Internally, it would give:
"Today's Date: 11-22-01
Hi There!"

When importing arrays, it outputs: Array but won't let anything be done to array, including grabbing array [0] for a string.

Any suggestions on what can be done? Any tricks I'm missing that I should try?

Example of it trying to work: http://bigheadstudios.co.uk/txm/testing.php

Thanks ahead of time

Line Return In External Variable
Hi,

I've got an external file with a variable which gets put into a dynamic text box (using Flash MX). I want to have a line return. At the moment, I have to put a return into the external file but that shows up as a new paragraph within flash. I want something like what would happen with the <BR> tag (which I know you can't use in flash). I also tried /n and /r but they didn't work. Does anyone have any suggestions?

Thanks,

Matthew Dingley

www.matthewdingley.co.uk

External Interface Return Types
hi.

i read that the External Interface class can return a value to JavaScript.

but is that value returned the boolean value in the addCallback() method that says whether the call succeeded or not?

...or, can i execute some other logic and return a different value, say from another method call in my callback method?

thanks.

fumeng.

Pause Main, Load & Play Movie, Return ...
I am creating a training "proto-type" project to open the eyes and minds of the office skeptics. Almost everything is in place except one critical piece, I need to play a flash video file (FLV) inside of the larger piece. I have a button in place to launch it. I just need to know how to pause the main timeline while the video plays. Also the video is only supposed to take up a small portion of the screen. All other main timeline buttons should still be visible and function normally. That includes stopping and exiting the movie if they are pressed.
I am using MX 2004 PRO.
I will attach the FLA from 2004 here.
let me know if you would like the FLV created with Camtasia and/or the FLA saved as MX (for you non-2004 users)

Thanks in advance for your help!

-Tex-

How To Return To Main Stage After Laodiing External Swf
hi, i have a question about the external swf things.
thanks in advance who ans me

is like this i have a main.swf, from the main.swf i call the external test1.swf,
becos the test1.swf will have it owns navigation all these and it takes up all the space in main.swf.

and then from the test1.swf i wanna go back the main.swf, what as should i use?

i know if the main.swf navigation appears in my test1.swf i can go back easily, but bcos my test1.swf take up full page of the main.swf and i hav a button for test1.swf to go back to the main.swf, so what as should i use?

thanks in advance!

Using An External Class / Function To Return Variables
Hi, just to preface, I'm pretty new to AS3 and having a hard time using external classes.

I'm using a class that I converted from AS2 to AS3 using Patrick Mineault's converter: http://www.5etdemi.com/convert/index.php

The original AS2 class:

Code:
/**
* Colour handling routines
* Culled from many places:
* - http://www.actionscript.org/forums/s...d.php3?t=15155
*
* @version 1.0
*/
class Colours extends Object {
/**
* Convert RGB values to hexadecimal number
* @param Number r Red value
* @param Number g Green value
* @param Number b Blue value
* @return Number RGB as a hex value
* @access public
*/
static function rgb2hex ( r:Number, g:Number, b:Number ):Number {
return ( r << 16 | g << 8 | b );
}
/**
* Convert a hex number into rgb values
* @param Number hex_col Hex colour to convert
* @return Object Object with r, g and b properties
* @access public
*/
static function hex2rgb ( hex_col:Number ):Object {
var red:Number = hex_col >> 16;
var green_blue:Number = hex_col - ( red << 16 );
var green:Number = green_blue >> 8 ;
var blue:Number = green_blue - ( green << 8 );
return ({r:red, g:green, b:blue});
}
/**
* Convert a hex colour to HSV colour
* @param Number hex_col Hex colour to convert
* @return Object Object with h, s and v properties
* @return Object Object with h, s and v properties
* @access public
*/
static function hex2hsv ( hex_col:Number ):Object {
var rgb:Object = Colours.hex2rgb( hex_col );
return Colours.rgb2hsv( rgb.r, rgb.g, rgb.b );
}
/**
* Convert a set of HSV values to a hex colour
* @param Number h Hue value
* @param Number s Sautration value
* @param Number v 'Value' value
* @return Number Hex colour to convert
* @access public
*/
static function hsv2hex ( hue:Number, sat:Number, val:Number ):Number {
var rgb:Object = Colours.hsv2rgb( hue, sat, val );
return Colours.rgb2hex( rgb.r, rgb.g, rgb.b );
}
/**
* Convert HSB (also known as HSV values) to a hex values
* @param Number h Hue value
* @param Number s Sautration value
* @param Number v 'Value' value
* @return Object Object with r, g and b properties
* @access public
*/
static function hsv2rgb ( hue:Number, sat:Number, val:Number ):Object {
var red, grn, blu, i, f, p, q, t;
hue%=360;
if(val==0) {return({r:0, g:0, b:0});}
sat/=100;
val/=100;
hue/=60;
i = Math.floor(hue);
f = hue-i;
p = val*(1-sat);
q = val*(1-(sat*f));
t = val*(1-(sat*(1-f)));
if (i==0) {red=val; grn=t; blu=p;}
else if (i==1) {red=q; grn=val; blu=p;}
else if (i==2) {red=p; grn=val; blu=t;}
else if (i==3) {red=p; grn=q; blu=val;}
else if (i==4) {red=t; grn=p; blu=val;}
else if (i==5) {red=val; grn=p; blu=q;}
red = Math.floor(red*255);
grn = Math.floor(grn*255);
blu = Math.floor(blu*255);
return ({r:red, g:grn, b:blu});
}

/**
* Convert RGB values to HSV value
* @param Number r Red value
* @param Number g Green value
* @param Number b Blue value
* @return Object Object with h, s and v properties
* @access public
*/
static function rgb2hsv ( red:Number, grn:Number, blu:Number ):Object {
var x, val, f, i, hue, sat;
red/=255;
grn/=255;
blu/=255;
x = Math.min(Math.min(red, grn), blu);
val = Math.max(Math.max(red, grn), blu);
if (x==val){ return({h:0, s:0, v:val*100});}
f = (red == x) ? grn-blu : ((grn == x) ? blu-red : red-grn);
i = (red == x) ? 3 : ((grn == x) ? 5 : 1);
hue = Math.floor((i-f/(val-x))*60)%360;
sat = Math.floor(((val-x)/val)*100);
val = Math.floor(val*100);
return({h:hue, s:sat, v:val});
}
}
The converted AS3 class:

Code:
package convertcolors {
/**
* Colour handling routines
* Culled from many places:
* - http://www.actionscript.org/forums/s...d.php3?t=15155
*
* @version 1.0
*/
public class Colours extends Object {

/**
* Convert RGB values to hexadecimal number
* @param Number r Red value
* @param Number g Green value
* @param Number b Blue value
* @return Number RGB as a hex value
* @access public
*/
static public function rgb2hex ( r:Number, g:Number, b:Number ):Number {
return ( r << 16 | g << 8 | b );
}

/**
* Convert a hex number into rgb values
* @param Number hex_col Hex colour to convert
* @return Object Object with r, g and b properties
* @access public
*/
static public function hex2rgb ( hex_col:Number ):Object {
var red:Number = hex_col >> 16;
var green_blue:Number = hex_col - ( red << 16 );
var green:Number = green_blue >> 8 ;
var blue:Number = green_blue - ( green << 8 );
return ({r:red, g:green, b:blue});
}

/**
* Convert a hex colour to HSV colour
* @param Number hex_col Hex colour to convert
* @return Object Object with h, s and v properties
* @return Object Object with h, s and v properties
* @access public
*/
static public function hex2hsv ( hex_col:Number ):Object {
var rgb:Object = Colours.hex2rgb( hex_col );
return Colours.rgb2hsv( rgb.r, rgb.g, rgb.b );
}

/**
* Convert a set of HSV values to a hex colour
* @param Number h Hue value
* @param Number s Sautration value
* @param Number v 'Value' value
* @return Number Hex colour to convert
* @access public
*/
static public function hsv2hex ( hue:Number, sat:Number, val:Number ):Number {
var rgb:Object = Colours.hsv2rgb( hue, sat, val );
return Colours.rgb2hex( rgb.r, rgb.g, rgb.b );
}

/**
* Convert HSB (also known as HSV values) to a hex values
* @param Number h Hue value
* @param Number s Sautration value
* @param Number v 'Value' value
* @return Object Object with r, g and b properties
* @access public
*/
static public function hsv2rgb ( hue:Number, sat:Number, val:Number ):Object {
var red, grn, blu, i, f, p, q, t;
hue%=360;
if(val==0) {return({r:0, g:0, b:0});}
sat/=100;
val/=100;
hue/=60;
i = Math.floor(hue);
f = hue-i;
p = val*(1-sat);
q = val*(1-(sat*f));
t = val*(1-(sat*(1-f)));
if (i==0) {red=val; grn=t; blu=p;}
else if (i==1) {red=q; grn=val; blu=p;}
else if (i==2) {red=p; grn=val; blu=t;}
else if (i==3) {red=p; grn=q; blu=val;}
else if (i==4) {red=t; grn=p; blu=val;}
else if (i==5) {red=val; grn=p; blu=q;}
red = Math.floor(red*255);
grn = Math.floor(grn*255);
blu = Math.floor(blu*255);
return ({r:red, g:grn, b:blu});
}

/**
* Convert RGB values to HSV value
* @param Number r Red value
* @param Number g Green value
* @param Number b Blue value
* @return Object Object with h, s and v properties
* @access public
*/
static public function rgb2hsv ( red:Number, grn:Number, blu:Number ):Object {
var x, val, f, i, hue, sat;
red/=255;
grn/=255;
blu/=255;
x = Math.min(Math.min(red, grn), blu);
val = Math.max(Math.max(red, grn), blu);
if (x==val){ return({h:0, s:0, v:val*100});}
f = (red == x) ? grn-blu : ((grn == x) ? blu-red : red-grn);
i = (red == x) ? 3 : ((grn == x) ? 5 : 1);
hue = Math.floor((i-f/(val-x))*60)%360;
sat = Math.floor(((val-x)/val)*100);
val = Math.floor(val*100);
return({h:hue, s:sat, v:val});
}
}
}
In the main swf I have imported the class:

Code:
import convertcolors.Colours;
On publishing I get no errors.

However, I don't really understand how to talk to the class to return some converted colour variables.

Here's my attempt:

Code:
//test convert
var hex_col = 0xffffff;
var convertedcol = Colours.hex2hsv(hex_col);
trace(convertedcol);
the trace returns "[object Object]"

What am I doing wrong? Is the AS2 to AS3 conversion part of the problem (aside from my ignorance of how to use it)?

Any help would be appreciated.
Thanks

Load External SWF1, Then Load External SWF2
I'm trying to load two different swfs, one after the other. After the first swf is loaded into it's own container (containerA) and is displayed to the viewer, I want to load the second SWF into its container (containerB) which will end up on top of the first SWF (the first SWF acts as a background layer).

Here is my code:
Code:


var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);

myListener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
   loadText._visible = true;
   var preloadPercent:Number = Math.round((loadedBytes/totalBytes) * 100);
   loadText.text = preloadPercent + "%";
};

myListener.onLoadComplete = function(target_mc:MovieClip) {
   loadText._visible = false;
}
//load in first swf
myMCL.loadClip("sand.swf", "loadBackground");


It makes sense to me to use an if statement, indicating "if sand.swf is loaded completely, the go ahead and load in movie.swf". But I everything that I have attempted fails. Can someone point me in the right direction as to how I can load in the second movie after the first one has been successfully loaded in.

Perhaps it's a matter of loading them at the same time, then displaying one after the other? I don't know.

Need help!
- popkes01

AS2: What Datatype Should A Function Return, If It May Not Return *anything*?
The title of this post may not make much sense, let me explain...

I have a function:

findSurface(origin:Point, vector:Point, attempts:Number):Point {...}

The function has an obscure use, but the idea is thus: given those three arguments, returns a point IF the 'line' (created by the origin and vector arguments) intersects the object the function is called on. [but that is another story...]

More importantly, if there is no point of intersection at all, what should the function return? Void? Null? Undefined? Object? Or can I use one of those return types instead of Point incase the function does not encounter an intersection?

I'd be glad to try explaining better if anyone might know, thanks.

Return Variables From Php To Load In Flash Text Variables
Im having an issue using the kirupa flash login. I already have the actual login working with php and mysql but i need to change it up a little bit and i don't know enough about php to write it myself. But here's the situation.

Flash login is a basic script, I've already modified this part and it works great

What I need to know is how to modify it so when a user logs in, php captures the $_POST and returns the alternate variable fields that consist of ("co","fname","lname","cph","email") within the ID for user and pass

also i have already made a common loadMovie to load random variables i just need the php to point to the movie

Load Load External Swf Movies And Paly At Same Time?
Hi. I am new here and i am desperate to have my problem solved please. I have an html page with 2 swf movies that should be playing at the same time (one shows logo of a company and the other shows at the same time the company's products). the problem is althought they are synchronized when played on my pc, when loading via internet they doen't play at same time because one is much bigger than the other and takes more time to load and play. so i thought of making a dummy swf movie that loads both swf movies and make them play at same time. Can anyone help me with the script needed for this? or is there a script that can be used on one movie and make it play only when the other one is fully loaded? please help !! thanks in advance!

Everytime I Load External SWF, ESWF Won't Load Jpgs And Txt
The external swf loads its jpgs and text perfectly fine by itself, but when I load it within my main movie the external swf doeasn't load the Jpegs and the vars in the Txt file. Why?


Zago...

Load External Text Inside An Already Loaded External Movie
here's the problem as simply as I can explain it.
there's a main.swf, a news.swf and a text.txt
the news.swf is loaded into the main.swf and I want to load the text.txt into the news.swf

everything works when I just load the text into the news.swf without loading it into the main.swf, so I know the text.txt part is loading.

[F8] External Text Files Wont Load Into External Swf File...
Hi,

I'm making a Flash website in Flash 8 (mac).

Structure: There is 1 main file that loads external SWF files depending on what is clicked on.

One of the external SWF files loads its text from external text files. This works fine when viewing the SWF applet on its own. But when viewing as a whole site, the text doesnt appear. Very annoying.

I made that particular SWF on my mums computer running Flash MX 2004. The flash file itself uses the Scrollbar component from MX.

Could someone tell me why the text doesnt load in this scenario? It runs fine on its own, just not as an external SWF.

I've attached the files in question. Its a 200kb ZIP download. Do tell me if you need to know more.

Thanks

How To Load An External Movie Using A Link Within An External Swf - Urgent
Hi all

Flash CS3 but coding in AS2 - mac.

I believe I have asked this question before but i was using loadMovie() - I am now using loadClip and the MovieClipLoader class and obviously I have managed to break something.

I have a number of external swfs which load fine, with preloaders using MovieClipLoader, into an empty MC on the stage called holder_mc. In one of the external swf's, there are two links to separate external swf's - if you click on either of them, the current swf is unloaded and the new one is loaded. I used:


Code:
myButtonWithinSwf.onRelease = function() {
this._parent.loadMovie("newMovie.swf");
}
However now that I am using a different code (because before, evrything wasnt preloaded, i just had a white space until it appeared) the code within the swf obviously has to change. The only problem is, I cant for the life of me work out what it is, I have tried all sorts of combinations and probably missed the most obvious one. I do not want to create empty movie clips, I want the movie to load into the MC which I have defined - holder_mc - and usually I would tell it to unloadClip() before loading the new one, but it cant load a new one if it has unloaded itself. I hope that makes sense!
This is the code I am using on the main timeline to control the preloading of the external swf's:


Code:
var mcLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
loadListener.onLoadStart = function() {
holder_mc.stop();
};
loadListener.onLoadProgress = function(target:MovieClip, loadedBytes:Number, totalBytes:Number) {
pleaseWait._visible = true;
var preloaded:Number = Math.floor(loadedBytes / totalBytes * 100);
preloaderMC._visible = true;
preloaderMC.loadText.text = preloaded.toString() + "%";
preloaderMC.loadBar._yscale = preloaded;
};
loadListener.onLoadInit = function() {
preloaderMC._visible = false;
pleaseWait._visible = false;
holder_mc.play();
};

/**** register listener object with MovieClipLoader object ****/
mcLoader.addListener(loadListener);

anotherButton.onRelease = function() {
mcLoader.unloadClip(holder_mc);
mcLoader.loadClip("anotherMovie.swf", holder_mc);
}
my preloader is called preloaderMC and pleaseWait is just a movie clip that is placed on the other side of the screen for another reason. loadText and loadBar are the dynamic text and loading bar within the preloaderMC.

I really hope someone can help me ASAP as this was all working before with loadMovie() and now suddenly I cant get it working!

Thanks in advance

Theo

Load External Swf From Html Formatted External Text?
Hi to all,

new to this forum, not so new to flash, but deeper AS...

I searched a while before asking now but didn#t found a solution for what i want to do.

may be someone can give me a hint to this:

I have a html formatted external text file and i want to call from this a external swf movie like

Code:
<a href="loadMovieNum("products.swf",10)">products</a>
I guess i need a asfunction for this?

So i read this:
http://www.macromedia.com/cfusion/kn...fm?id=tn_15639

But still get not the trick how to..?

I tried this:
in 1. Frame of movie i placed:

Code:
function myFunction () {
loadMovieNum("products.swf",10);
}
and changed html text in:

Code:
<a href="asfunction:myFunction">products</a>
when i publish and add a trace function is still got the comment i gave in trace but external swf is not loaded.
I get no error in output window, but not loaded.

Any ideas or hints?

Would be great.

Thank you for a hint.

all best
cyrano

Trigger External Swf To Load Into Main Swf From Button In Another External Swf
I'm really stuck with this and it seems like such a simple problem to solve.

I am trying to get a nav button in one movie (main_nav.swf) to target a my main movie (index.swf) and load a sub nav movie (metals_subnav_infinite.swf) into it. The sub nav movie will do a similar task - loading a portfolio swf into main movie (index.swf).

Here is the file breakdown of my working files:

index.swf - main final movie which loads "main_nav_infinite3.swf" on start

main_nav_infinite3.swf - loads main nav "main_nav.swf" and scrolls it infinitely (infinite menu)

main_nav.swf - main nav with buttons that trigger sub nav "metals_subnav_infinite.swf" to load into index.swf

metals_subnav_infinite.swf - loads sub nav "metals_subnav.swf" and scrolls it infinitely

metals_subnav.swf - sub nav with buttons that trigger "folio.swf" (have not created this file yet!) to load into "index.swf"


The script I was focusing on is in main_nav.fla and it is:

metals_mc_bn.onRelease = function() {
reActivateMenu();
this.gotoAndStop(3);
this.enabled = false;
_level1.sub_nav_content_mc.loadMovie("metals_subna v_infinite.swf");
};

I haven't yet activated all the buttons yet just the "Metals" button as the first to get working.

I have attached the FLAs.


exxie!

How To Load An External Movie Using A Link Within An External Swf - Urgent
Hi all

Flash CS3 but coding in AS2 - mac.

I have asked this question before but i was using loadMovie() - I am now using loadClip and the MovieClipLoader class and obviously I have managed to break something.

I have a number of external swfs which load fine, with preloaders using MovieClipLoader, into an empty MC on the stage called holder_mc. In one of the external swf's, there are two links to separate external swf's - if you click on either of them, the current swf is unloaded and the new one is loaded. I used:


Code:
myButtonWithinSwf.onRelease = function() {
this._parent.loadMovie("newMovie.swf");
}
However now that I am using a different code (because before, evrything wasnt preloaded, i just had a white space until it appeared) the code within the swf obviously has to change. The only problem is, I cant for the life of me work out what it is, I have tried all sorts of combinations and probably missed the most obvious one. I do not want to create empty movie clips, I want the movie to load into the MC which I have defined - holder_mc - and usually I would tell it to unloadClip() before loading the new one, but it cant load a new one if it has unloaded itself. I hope that makes sense!
This is the code I am using on the main timeline to control the preloading of the external swf's:


Code:
var mcLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
loadListener.onLoadStart = function() {
holder_mc.stop();
};
loadListener.onLoadProgress = function(target:MovieClip, loadedBytes:Number, totalBytes:Number) {
pleaseWait._visible = true;
var preloaded:Number = Math.floor(loadedBytes / totalBytes * 100);
preloaderMC._visible = true;
preloaderMC.loadText.text = preloaded.toString() + "%";
preloaderMC.loadBar._yscale = preloaded;
};
loadListener.onLoadInit = function() {
preloaderMC._visible = false;
pleaseWait._visible = false;
holder_mc.play();
};

/**** register listener object with MovieClipLoader object ****/
mcLoader.addListener(loadListener);


anotherButton.onRelease = function() {
mcLoader.unloadClip(holder_mc);
mcLoader.loadClip("anotherMovie.swf", holder_mc);
}
my preloader is called preloaderMC and pleaseWait is just a movie clip that is placed on the other side of the screen for another reason. loadText and loadBar are the dynamic text and loading bar within the preloaderMC.

I really hope someone can help me ASAP as this was all working before with loadMovie() and now suddenly I cant get it working!

Thanks in advance

Theo

Load External Html Txt , Using Ext Txt To Load MC In _level
Hi Everyone,
thank God for Forums,

I really need some help and much appreciate if you guys can me.

I have flash movie load a ext txt file:
http://www.zootopia.net/test/

The txt file is HTML formatted so flash reads it as html.
I use html link in the ext txt file - ie. <a href="#">this is a link</a>

My Aim:
Is it possible to have the html link tell flash to load another MC into a new level or goto frame 2?, then load another ext txt file??

eg. <a href=" gotoFrame 2 and load another ext txt file">

What do you guys think, love to know any suggestions

External Clip, External Variables Don't Load
hi all,

I'm having some trouble with external variables and external movie clips. I have a main movie, and one part of it is an external movie, the main movie has a bunch of variables stored in a text file. This works fine. The external movie also has a bunch of variables in a different text file. When I play the external movie on it's own it works fine too. When I load the external movie from my main movie, the movie loads but the variables don't. Is there a special way to do this with more movies, do I have to load variables on different levels or something?

I generally use this to load variables

loadVariables ("roznet.txt", "");

I have tried using absolute paths as well (http://) but the same thing. It works by itself but when it is within my main movie the variables don't load. Any ideas? Thanks.

How Can I Load External JPEG From External File?
I know I should read manual.., but I don't have now.
So please someone help me.
I am trying to load JPEGS from external file into MC.

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?

External Swf File Does Not Load External Text
Hi,
I have an external text file that loads dynamically in my swf file.
It uses the actionscript:

loadVariables("joblist.txt","_root");

When I play the swf it works perfectly with the text scrolling in the dynamic text field, but when I load this swf file into my main swf file with loadMovie, the text does not appear.
I have tried embedding the fonts in both files, but it still does not show up when loaded into the main movie.
Can anyone help me with this?

External Text Load On External Swf Problem?
ok heres the problem, i have a site, and on the main screen it loads an external movie clip onto the space available. loading the movie clip is not a problem, but the thing is that when i do, the external text loading function on the external swf doesnt work. any ideas?

Have An External .swf Load Into Scene Upon Load
I have created a banner / nav bar for a site in a main .swf. For each button on the nav bar i have actions planned to load external .swf's into placeholder mc's within the main .swf to display content. how can i script the "home" external .swf content to load into the main .swf when the page first loads? is it an
upon load type script? thanks -sean

Have An External .swf Load Into Scene Upon Load?
I have created a banner / nav bar for a site in a main .swf. For each button on the nav bar i have actions planned to load external .swf's into placeholder mc's within the main .swf to display content. how can i script the "home" external .swf content to load into the main .swf when the page first loads? is it an
upon load type script? thanks -sean

Have An External .swf Load Into Scene Upon Load?
I have created a banner / nav bar for a site in a main .swf. For each button on the nav bar i have actions planned to load external .swf's into placeholder mc's within the main .swf to display content. how can i script the "home" external .swf content to load into the main .swf when the page first loads? is it an
upon load type script? thanks -sean

Can I Load An External SWF Into A Container MC From Another External SWF (NAV)? HELP
DETAILS:

Main Movie contains two empty MCS one instance is called container and the other nav_container.

When the movie first loads, it preloads on frame 1, and then goes to frame two. Frame two has an action to load some sound, and the home_nav.swf file into the load_movie.swf file's nav_container.

This is where I run into my problem. From the home_nav.swf file, I have some script on my buttons. The buttons call an external file swf (subpage - content) to load into container MC (on load_movie.swf timeline). I cannot get the script to call in these subpages! Here is the script I used:

on (release) {
_root.container.loadMovie("social.swf");
}


I assume it's a path issue? I feel like i have tried everything...i'm sure it's something simple that I missed.

I appreciate your help!

Thanks,

Valerie

On External Swf Stop; Load New External Swf
Ok I've searched the tutorials and forums to no avail so here goes.

I have a splash intro/logo swf that when clicked plays to the end and stops. Then I have another swf that I want to load and play when the first intro swf is finished. But I don't want the second swf to be visible during the splash intro swf screen.

I've tried using tsomething like this

onClipEvent (enterFrame)
{
if (this.instance._currentframe == 140)
{
loadMovie("blah",3)
}
}

but it seem that at the time the MC enters the frame the intro swf isn't at frame 140 then it doesn't ever go back and check, so it seems I need to make a loop to keep checking to see what frame the intro swf is at but I'm not sure how to do that? is it a "for" statement or a "do while"?

thanks a bunch,
Ethan

Load External SWF In Main From External SWF...
Ok,

Here's my problem...

Can someone explain to me how to load an external swf from an external Swf into the main, and what level it should go on? My example:

I have a main where MENU loads as an external SWF on the initial load... On MENU there is a button to load GALLERY back into the main... I want it to replace level 1. I have placed an empty container for the GALLERY with the instance name "mygallery" on my main. What is the code to put on the button... so far I have:

on (release)
{
_root.mygallery.loadMovie("gallery.swf", 3);
}

I am calling this to load on level 3... should I be doing that? Also, could someone please tell me what code I should have on my main for the container. I have:

createEmptyMovieClip("gallery_holder", 3);

I hope I explained this well enough, I'm kinda new at this and trying to learn my best... THANKS!

Load External SWF In Main From External SWF...
Ok,

Here's my problem...

Can someone explain to me how to load an external swf from an external Swf into the main, and what level it should go on? My example:

I have a main where MENU loads as an external SWF on the initial load... On MENU there is a button to load GALLERY back into the main... I want it to replace level 1. I have placed an empty container for the GALLERY with the instance name "mygallery" on my main. What is the code to put on the button... so far I have:

on (release)
{
_root.mygallery.loadMovie("gallery.swf", 3);
}

I am calling this to load on level 3... should I be doing that? Also, could someone please tell me what code I should have on my main for the container. I have:

createEmptyMovieClip("gallery_holder", 3);

I hope I explained this well enough, I'm kinda new at this and trying to learn my best... THANKS!

Load External Swf W/ External Doc Class
Hi guys, i'm new here to the forum so please be gentle :-)

I've recently made the plunge to AS3 and the OOP environment and i'm having this little headache... I have two SWFs, a main one a module i want to load in to the main one... both have their own document classes... the Module SWF, in turn accesses several external AS files in the same directory structure as my Main SWF...

Both individually compile and work fine.... but when i load the Module SWF into my main SWF project i get this message:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at Module$iinit()

Which i guess is flash trying to tell me that it can't access the Module's SWF's document class?

I have read around on this subject and i think it's something to do with setting the class path for my project... so i did that in the publish settiings of the main flash flash file on the AS3 button, set the class path to include the same folder as the document class for the Module SWF, but still the same error...

Anybody have an idea what could be going on here?

Thanks,

N.

:D Pre-Load/Loading (external .swf) To (external.swf) Need A
Well I have 3 flash files:

PRELOADER.SWF (Containing the loading bar)
Index1.swf (actionscript to load PRELOADER.SWF and to move onto Index2.swf..
Index2.swf Main splash page to site.

Heres the actionscript:

Code:

stop();
//-------------------------<MCL>-------------------------\
var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);
//-------------------------</MCL>-------------------------\
myListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
_level50._visible = true;
_level5._visible = false;
var preloadPercent:Number = Math.round((loadedBytes/totalBytes)*100);
_level50.preloader.gotoAndStop(preloadPercent);
};
myListener.onLoadComplete = function(target_mc) {
_level50._visible = false;
_level5._visible = true;
_level5.play();
};
myMCL.loadClip("preloader.swf", 50);
// trigger the MCL to load this:
myMCL.loadClip("index2.swf", 5);


Problems ?

Well It works in Firefox BUT the loading bar is in reverse ?? Its actually degrading the fill of the bar instead of increasing.

In I.E. it loads ok first time but still Loading Bar in reverse. Also if you reload page bar is still visisble..

I presume my coding isn't correct and its a simple fix.. Please send me correct code I presume its a simple fix and just a bug with my loading bar code.

Thanks .

Help Trigger External Movie To Load From Button In Another External Movie - Stuck
I really hope someone can help me!!!

I am loading movie C.swf into movie B.swf which gets loaded into movie A.swf the main movie. All loading works except C.swf has buttons that need to trigger another movie E.swf to load into A.swf and that is not working!!!

Here is the structure I am using:

A.swf (main final movie loads B.swf on start)
B.swf (loads main nav C.swf and scrolls it infinitely)
C.swf (main nav with buttons that trigger sub nav E.swf to load into A.swf)
E.swf (sub nav with buttons that trigger F.swf to load into A.swf)
F.swf (scrolling images of portfolio)

The actionscript I am using for the button in C.swf to trigger E.swf to load into the main movie A.swf is:

metals_mc_bn.onRelease = function() {
reActivateMenu();
this.gotoAndStop(3);
this.enabled = false;
loadMovieNum("E.swf", 1); // trigger sub nav E.swf to load into A.swf
};

I am so stuck with this and seems so simple a problem, but I'm just pulling hairs out at this point, can anyone please help me!

How To Load External .swf's On Top Of Each Other?
Hey Guys,

I've got a setup similar to what's currently on the Macromedia's site right now (www.macromedia.com).

I have a menu, with a nav on the left that you can select from. Upon clicking on any link, an independent movie is loaded and animated across the screen (a wash effect from left to right).

Now this works well by itself for each link. But if I click on one link, then a different one, the movie is loaded below the current movie, so you don't see it. What I want to do is have the new movie be on top everytime.

Here is my current script for the 'on (release)':

loadMovie ("championway.swf", "championway");

Obviously, the "championway" is an empty movie clip I placed on the main stage for the swf to load into.

Any ideas?

Thanks,

Ed

How Do I Load An External Swf ..?
Hi All (again)

Its been a busy day on the boards

How do load an external swf file (from swift3d) into a MC??

Cheers XD

Load External Txt
Hello:
What I´m trying to do is load an external text and would like to specify the font. I would like to use a Mandingo type and don´t know how it´s done. I´m using flash 5. Thanks in advance for anyone who helps

Load External .SWF
Im having trouble with the loading action, this is the path im using

on (release) {
loadMovieNum ("main.htm/SWF/animate.swf", 1);
}


Ive given it the path to the folder im storing the external SWF. guess what? it doesnt work any ideas big help thanks Paul

Load External .swf
Ok here is a layout I have:

I have 3 movies: 1 movie (main) which i want to use to load and control the other movies,

on the first frame of the main movie I have the following code
loadMovieNum("mc_1.swf",1);

on the second frame of the main movie I have the following code
loadMovieNum("mc_2.swf",1);

well what happends is that it plays mc_1 no problems but when finished it will not play mc_2.

what I would like to be able to do is have mc_1 play then have mc_2 play after it is done playing. Can someone help me out with the code for this please.

Thanks in adavnce,

Craig

Copyright © 2005-08 www.BigResource.com, All rights reserved