#1 2017-04-05 15:56:05

fakie
Banned
Registered: 2016-10-28
Posts: 36

How to fire an Image "Load" event.

Hi David.

Would I fire an Image load event by just placing code into the "Load" part of the image code?

I used your slider example, with the dog,pelican and dog.
I added an Info text field, and placed the following code in the Image1 Load source code module..

GetAttribute "Image1" "src" "[tmp]"
GetAttribute "Image1" "width" "[w]"
GetAttribute "Image1" "targetheight" "[h]"

SetVar "[Info.Value]" "Load:[tmp] [w]x[h] [Image1.Data]" "String"

But the w and h is always undefined, although the tmp value is filled in.

What am I doing wrong?


This is my favourite quote.

Offline

#2 2017-04-05 16:47:52

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to fire an Image "Load" event.

Hello fakie,

The Image control doesn't have a "width" nor "height" attributes, except if we set it explicitly. What you can use is the "GetStyle" action instead the "GetAttribute" one:

GetStyle "Image1" "width" "[w]"

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.