What's wrong with this simple handler?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
What's wrong with this simple handler?
I have a map graphic on a card. I named it "worldMap".
In the card script, I have:
on mouseUp
initMap
end mouseUp
In the stack script, I have. (note that I get the same error whether the script is in the stack or the map graphic script)
on initMap
put the formattedWidth of "worldmap" into mapWidth
put the formattedWidth of "worldmap" into mapHeight
end initMap
I get an error message at the "put the formattedWidth of ...."
error message: image "worldmap": execution error at line n/a (Chunk: error in object expression) near "worldmap", char 1
What the heck? This is just like one of the lessons???
In the card script, I have:
on mouseUp
initMap
end mouseUp
In the stack script, I have. (note that I get the same error whether the script is in the stack or the map graphic script)
on initMap
put the formattedWidth of "worldmap" into mapWidth
put the formattedWidth of "worldmap" into mapHeight
end initMap
I get an error message at the "put the formattedWidth of ...."
error message: image "worldmap": execution error at line n/a (Chunk: error in object expression) near "worldmap", char 1
What the heck? This is just like one of the lessons???
Bill Prothero
Re: What's wrong with this simple handler?
The "formattedWidth" is for text fields only.
Try "the width".
Try "the width".
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: What's wrong with this simple handler?
The engine needs to know what "worldmap" is, so supply an object type: the formattedwidth of image "worldmap"
Unless it really is a graphic object, in which case use "graphic" instead of "image".
Unless it really is a graphic object, in which case use "graphic" instead of "image".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: What's wrong with this simple handler?
Q: You can get the formattedWidth of an image?
A: Yes you can. I just looked it up. Learned something new.
http://docs.runrev.com/Property/formattedWidth
A: Yes you can. I just looked it up. Learned something new.
http://docs.runrev.com/Property/formattedWidth
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: What's wrong with this simple handler?
Yeah, since you can lock the size to something different.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
Re: What's wrong with this simple handler?
I got it working with
Put the formatted width of image "worl map" into x
The tutorial had, as an example
Put the formattedwidth of pImageID into x
So, I just put the image I'd number in for pImagdeID, but now I wonder if I put that number in quotes. I'll,have to try it without quotes before I blame the tutorial.
By the way, what's the difference between an image and a graphic?
Thanks for the answers,
Bill
Put the formatted width of image "worl map" into x
The tutorial had, as an example
Put the formattedwidth of pImageID into x
So, I just put the image I'd number in for pImagdeID, but now I wonder if I put that number in quotes. I'll,have to try it without quotes before I blame the tutorial.
By the way, what's the difference between an image and a graphic?
Thanks for the answers,
Bill
Bill Prothero
Re: What's wrong with this simple handler?
Hi Bill,
Lookup "long ID" etc. in the dictionary.
...
put the formattedwidth of img ID 1003 into x
...
graphic = vector graphic =resolution independent
Scale anm image and a graphic and you will see the difference
Best
Klaus
where pImageID is a variable which will probably hold the "long ID" or the "long NAME" of the image!waprothero wrote:I got it working with
Put the formatted width of image "worl map" into x
The tutorial had, as an example
Put the formattedwidth of pImageID into x
Lookup "long ID" etc. in the dictionary.
No quotes!waprothero wrote:So, I just put the image Id number in for pImagdeID, but now I wonder if I put that number in quotes. I'll,have to try it without quotes before I blame the tutorial.
...
put the formattedwidth of img ID 1003 into x
...
image = pixel imagewaprothero wrote:By the way, what's the difference between an image and a graphic?
graphic = vector graphic =resolution independent
Scale anm image and a graphic and you will see the difference

Best
Klaus
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
Re: What's wrong with this simple handler?
Thanks for the definition. I always considered an image to be a graphic, so it's good to know the livecode distinction.
Bill Prothero