Caspar text fields update

Hello folks!

I am back again with probably another silly question…

I prepared a flash multi page with 30 dynamic fields (text)
The gfx goes smoothly but I cannot find a way to update my text fields when using _caspar.cg_next

I made a function replacing my data with the same instance names (I have more than 300 fields in total) so to avoid to named all the fields in all the pages with different names.

The server log gives me error 404.

I use the command update and then next.

What is the correct procedure to follow in easy steps?

Thank you a lot in advance!

Federico

If I understand you right you have 10 pages with 30 Textfields each, right? On all pages these Textfields have the sane instance name, right? If that is the case you have 10 instances with the same instance name. To be able to access these fields from ActionScript the instance names need to be unique. But there is an easy trick. Wrap your pages into a MovieClip for each page, then name each instance name of the MovieClip defferently. Now you can access your Textfields as MovieClipInstanceName.TextFieldInstancenNme and if done properly this combined name is unique and your code works.

1 Like

Hello!

Thanks for your help man! You are always present!

I have done several noob tries but not yet success…

this is the sub that address the text to the template:

Private Sub NextPageBtn_Click(sender As Object, e As EventArgs) Handles NextPageBtn.Click

    Dim dataView As DataView = frmMain.StartListGW.DataSource
    If frmMain.StartListGW.SelectedRows.Count > 0 Then
        dataView.Sort = "StartNumber ASC"
    Else
        MsgBox("At lease one event from the schedule must be selected")
        Exit Sub
    End If

    Dim table As DataTable = dataView.Table
    Dim rangeEnd As Integer = 9
    Dim pagesEnd As Integer = 11

    Dim tmpl As Template = New Template
    ' check if less data than 1 page or total pages less than 11 (checks everytime...must be fixed)
    If table.Rows.Count < rangeEnd Then
        rangeEnd = table.Rows.Count - 1
        pagesEnd = 1
    ElseIf table.Rows.Count < pagesEnd * 10 Then
        pagesEnd = table.Rows.Count / 10
    End If
    'update currPage
    currPage = currPage + 1
    Dim k = 0
    'check if last page
    If currPage < pagesEnd Then
        For i As Integer = 0 + ((currPage - 1) * 10) To rangeEnd + ((currPage - 1) * 10)

            'TV name applied to data view for firstname
            dataView(i).Item(1) = dataView(i).Item(1).Substring(0, 1).ToUpper & "." & " "
            'Dim dataRow As DataRowView = dataView(i).Item(0)
            tmpl.Fields.Add(New TemplateField("page2""st" & k + 1, dataView(i).Item(0)))
            'add the commented string only for template with name field
            'tmpl.Fields.Add(New TemplateField("name" & i + 1, ""))
            tmpl.Fields.Add(New TemplateField("page2""surname" & k + 1, dataView(i).Item(1) & " " & dataView(i).Item(2)))
            '_Caspar.Data_Store(dataView(i).Item(1).ToString, dataView(i).Item(2)).ToString()

            k = k + 1
        Next
    End If
    'MovieClipInstanceName.TextFieldInstancenNme

    'UPDATE DATA NOT WORKING YET FOR MULTIPAGE
    '_Caspar.CG_Invoke(10)

    _Caspar.CG_Update(tmpl)
    '_Caspar.CG_Add(tmpl)
    _Caspar.CG_Next(10)
End Sub

I put page2 before to run a +1 cycle only for testing.

Do you see any enourmous mistake?

Thanks!