B4J Question [ABMaterial] change AbmImage image

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I had show a Abmimage in the abmpage. How could i get other image to replace it ?
 

jinyistudio

Well-Known Member
Licensed User
Longtime User
I try following ok:

1. get ths ABMImage in the page first
Dim img As ABMImage=page.Component("tipsimg")

2. re-initialize it, assign a new image file and refresh
img.Initialize(page,"tipsimg","../tips/"&s1,1)
img.Refresh
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Although in this particular case it may have worked, it is NEVER a good idea to run Initialize again! This can generate errors in your code that are very hard to trace.

You can change the image by changing the source:

B4X:
Dim img As ABMImage=page.Component("tipsimg")
img.Source = "../tips/" & s1
img.Refresh
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
I download a image file(shot.jpg) every 100ms(this is OK) from ip-webcam and then refresh it to abmimage in the abmpage. but the image isn't change. Why ... ?


B4X:
Sub timer1_tick[/B]
[B]    If Not( loading) Then
        Dim ipcam1 As ABMImage=page.Component("ipcam1")
        ipcam1.Source="../icons/shot.jpg"
        ipcam1.Refresh      
      
        Dim job1 As HttpJob
        job1.Initialize("ipcam", Me,Null)
        job1.Download("http://192.168.1.200:8080/shot.jpg")
        job1.GetRequest.Timeout=3000
        job1.GetRequest.SetHeader("Authorization","")
      
        loading=True
    End If  
End Sub


719612bc7c5d38435bc22958fd51431a.png
 
Last edited:
Upvote 0
Top