FastScript: Storing object in array. Bug or Quirk?

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.

  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;

FastScript: Storing object in array. Bug or Quirk?

Postby pmk65 » Mon Jul 24, 2017 8:24 pm

I wrote a small function for creating animated images, based on your example code here: http://forums.blumentals.net/viewtopic.php?f=33&t=5976

Im storing the animation sequence in an array, but if I do it like this:

Code: Select all
   for (var i=imageCount-1;i>=0;i--) {
      imageAnimSeq[i] = new TImage(WeBuilder);
      imageAnimSeq[i].Parent = parentObj; // This line gives the error
      imageAnimSeq[i].Picture.LoadFromFile(RegexReplace(imageFile, "\\.(?=[^.]*$)", _t(i) + ".", true));
      imageAnimSeq[i].Visible = false;
      imageAnimSeq[i].SetBounds(posx, posy, imageWidth, imageHeight);
   }


I get an error "Compile error: Access violation at address 00493D19 in module 'webuild.exe'. Read of address 00000030"
But if I first store the TImage in a normal variable, and then copy that into the array like this. Then it works.

Code: Select all
   for (var i=imageCount-1;i>=0;i--) {
      img = new TImage(WeBuilder);
      img.Parent = parentObj;
      img.Picture.LoadFromFile(RegexReplace(imageFile, "\\.(?=[^.]*$)", _t(i) + ".", true));
      img.Visible = false;
      img.SetBounds(posx, posy, imageWidth, imageHeight);
      imageAnimSeq[i] = img;
   }


Is this a bug or just one of the FastScript quirks?
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 381
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: FastScript: Storing object in array. Bug or Quirk?

Postby Aivars » Sat Aug 05, 2017 4:11 pm

It might be a quirk because that array is actually Variant and an array stored in Variant is a strange creature in itself, I wouldn't ever do it in my code but in this case the script engine does.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 1989
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia


Return to HTMLPad / Rapid CSS / Rapid PHP / WeBuilder Support

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron