Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

loadMovie Dynamic Url Problem

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;
   newData=movTitle+".swf";
   trace(newData);
   trace(typeof(newData));
   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.
      
0
whitetuna1
Asked:
whitetuna1
  • 6
  • 4
  • 2
  • +1
2 Solutions
 
blue-genieCommented:
Hi,

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(newData);
trace(typeof (newData));
loadMovieNum(newData, 0);
0
 
FLAASHERCommented:
as blue-genie said
u must use loadMovieNum not loadMovie cause u load into level
0
 
whitetuna1Author Commented:
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.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
blue-genieCommented:
dude, i just copy and pasted the code in a frame and it works just dandy.

i'd suggest you check for typos.
0
 
DarkEntityCommented:
haven't used much of loadMovieNum.

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

:B
0
 
FLAASHERCommented:
hi whitetuna1
try this
its work

www.midoco.com/loadit.zip
0
 
FLAASHERCommented:
frist.swf contain action script and load 335.swf in level 0
0
 
whitetuna1Author Commented:
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()
{
      if(ParseInt(sold)==1){
            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(){            
            newData=movTitle+".swf";
            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;
      bt.url=lot;            
      bt.setBttnZ(lot);      
      
      var mc;
      mc = _root.attachMovie("dot_mc", "dot"+lot, i+101);      
      mc.idx = i+100;      
      mc.setDotZ();      
      i++;
      if(i<77){            
            gotoAndPlay(47);
      }

I have to go out now. Will be back tomorrow.
Thanks for all the help so far.
0
 
FLAASHERCommented:
man
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.
0
 
FLAASHERCommented:
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
0
 
whitetuna1Author Commented:
Thanks FLAASHER.

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.
0
 
whitetuna1Author Commented:
The Accepted answer should be one comment prior, but it's still FLAASHER.
0
 
FLAASHERCommented:
Just try to help :)

thanks man for the points:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 6
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now