Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


loadMovie Dynamic Url Problem

Posted on 2004-09-22
Medium Priority
Last Modified: 2012-05-05
Hi, I'm going crazy with this problem, so any help would be greatly appreciated. (using Flash MX Pro v7.2)
I can't get loadMovie to work via a dynamic path as set out below:
   moveTitle=335; // moveTitle is really a number read in from a text file;
   loadMovie(newData, 0);

The trace indicates that newData is 335.swf and is of type string, however loadMovie(newData, 0) doesn't work.
If I hardcode the string, then it does work. i.e. loadMovie("335.swf", 0)
I have also tried loadMovie(eval(newData),0), but still no joy.

Any ideas? Thanks in advance.
Question by:whitetuna1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +1
LVL 39

Assisted Solution

blue-genie earned 800 total points
ID: 12130819

first of all
moveTitle and movTitle is not the same i.e. typo

secondly, u're using loadMovie (which expects a target to load into, not a level - which u've specified using the 0).

so instead, use loadMovieNum as in:
moveTitle = 336;
// moveTitle is really a number read in from a text file;
newData = moveTitle+".swf";
trace(typeof (newData));
loadMovieNum(newData, 0);
LVL 13

Expert Comment

ID: 12130879
as blue-genie said
u must use loadMovieNum not loadMovie cause u load into level

Author Comment

ID: 12130886
Thanks, but...

The movTitle and MovTitle were only typos here. I just typed this in as an example of what I'm trying to do.
I've tried loadMovieNum(newData, 0); previously and it doesn't work either.

Can Flash accept a variable for a path like this? Do you have any working examples of it doing so?

Thanks for the prompt assistance.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 39

Expert Comment

ID: 12130899
dude, i just copy and pasted the code in a frame and it works just dandy.

i'd suggest you check for typos.

Expert Comment

ID: 12130916
haven't used much of loadMovieNum.

try using "_root.loadMovie(newData);" or within the "OnLoad() {...}" call "loadMovie(newdata);"

LVL 13

Expert Comment

ID: 12130918
hi whitetuna1
try this
its work

LVL 13

Expert Comment

ID: 12130925
frist.swf contain action script and load 335.swf in level 0

Author Comment

ID: 12130962
Ok. These work, but I'm still not sure what I'm doing wrong in my code. I'll give you the whole frame and you might get an idea of the context in which I'm trying to use it. Could be a typo.

MovieClip.prototype.setDotZ = function()
            this._visible = false;
      this._x = parseInt(xdot);
      this._y = parseInt(ydot);       

Button.prototype.setBttnZ = function(movTitle)
      this._alpha = 20;      
      this._x = parseInt(xbttn);
      this._y = parseInt(ybttn);
      this.onRelease = function(){            
            trace(newData);                          // this displays the expected output
            trace(typeof(newData));               // this displays the expected output
            this.loadMovieNum(newData, 0);   // this does nothing.
      var bt;      
      bt = _root.attachMovie("bttn_bt", "bttn"+lot, i+1);
      bt.idx = i;
      var mc;
      mc = _root.attachMovie("dot_mc", "dot"+lot, i+101);      
      mc.idx = i+100;      

I have to go out now. Will be back tomorrow.
Thanks for all the help so far.
LVL 13

Expert Comment

ID: 12131004
look here

 this.loadMovieNum(newData, 0);   // this does nothing.

no need to write"this" .you load into level not target
and nad your target here is a button not a movie clip
u must write

loadMovieNum(newData, 0);   // this does nothing.
LVL 13

Accepted Solution

FLAASHER earned 1200 total points
ID: 12131057
onother thing
we suppose that u put the code in frame so i cant imaginehow is ur file
so, please send the FLA file if u can to c it clearly
:) sanks

Author Comment

ID: 12138675

I was sure I'd tried that before (I got to the point where I was trying anything) and had no success. I just tried it again without the .this and it worked!

Thanks also to blue-genie. I did require loadMovieNum

Thanks for all the help.

Author Comment

ID: 12138681
The Accepted answer should be one comment prior, but it's still FLAASHER.
LVL 13

Expert Comment

ID: 12153464
Just try to help :)

thanks man for the points:)

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question