Hi Mercedes,
mercedes wrote:....How many videos do u have..and how many hotspots--play video..and also stop it..with variables..
Well, in that frame there are 4 videos. There are also 4 hotspots associated with those videos. There is only one hotspot, right now, that I have the "StopVideo" command in (because that one goes to another frame). But there is a total of 9 hotspots in that frame.
Hth some...
...will try to type more later with some more information, but gotta run for now...
Thanks!
-----------------------[EDIT 1]-------------------------------------
Okay, I think I am getting closer to what exactly the issue is. I Googled this error message and one person stated it was due to
"...trying to access element (#) of a control array that has not yet been loaded...." -
http://www.tech-archive.net/Archive/VB/microsoft.public.vb.controls/2004-08/0232.html. Also I read in another place where someone reset their variable and it worked for them -
http://www.xtremevbtalk.com/showthread.php?t=13790
I think this is happening to my code. The play video/click counter hotspot is not being loaded at loadgame time, before the hotspot containing the "StopVideo" code is accessed. But if I load a game and access the hotspot containing the play video/click counter variable, and then access the hotspot with the "StopVideo", I don't get the error message.
So it seems that I need some way to either
reset the counter variable upon loadgame, or somehow
load the counter information so AM will recognize it after a saved game has been loaded. But the question now is how to do it.
Any clues?
Thanks.
-----------------[EDIT 2]-----------------------------------
Okay...something just came to mind...it is a non-VBS approach which may work for this...I'll let you all know...
Cya...
-----------------[EDIT 3]-----------------------------------
Okay, after many hours of trial and error, I found that there is no real non-VBS approach to solving this problem. I also tried practically every permutation of VBS coding that I knew (which is relatively small since I am just learning). However, through much brain agonizing and prayer (literally), I think that I have found a solution that should tackle this problem once and for all (and for other Control Array issues, as well). I tested this solution out several times and I can't get it to display the
"Control array element '3' doesn't exist" error message any more.
So what I did in order to resolve the error message for the
"Control array element '3' doesn't exist" problem was to...[drum roll]...load the control that allegedly did not exist!
Okay, I know that really is not profound but I suspected earlier that I had to do this, but I didn't know how. It loads when you access it during game play, but coming from a
loaded game, the control just isn't accessed before being called upon in a hotspot that uses code that is dependent on it in some way. So I literally loaded the control in the hotspot that was calling it, and voila!
So just for a
mini-tutorial for future reference with similar issues, when you get a
"Control array element '#' doesn't exist" error message, try the following:
1) Go to the
VBS Procedure (Advanced) link (found in the main menu on the left) and look for the control array number in the "
PlayVideo" Sub Routine code (or other applicable
"LoadControl" code). In my case it is number "3". This corresponds to the following code in my
VBScript Global Procedures:
- Code: Select all
Action.LoadControl MediaPlayerObject(3)
2) Highlight and copy the code.
3) Then go to the frame that the error is occurring (the same frame where you clicked the hotspot that showed that error message) and open up the
"Properties" of the offending hotspot.
4) Go to the
"Advanced" tab and paste the code in at the top.
5) Then play the game as usual and it should work now with no more error message.
I haven't tried it at the Frame Properties > Advanced Tab level, but it should work (in the theory) I would imagine. I am just glad I finally got it to work in the offending hotspot, so I'm not touching it!
Well, trying to resolve this issue has been one grueling ordeal, to say the least. Hopefully, though, the approach I used will be applicable to other control array issues so that other AM game devs. won't have to use up so much time like I did. But I am happy now!
Again, thanks you guys [ okay, okay, you "gals" and one "guy";) ] for steering me in the right direction.
Take care and happy coding!