How to use the "Actor.create" function in Scaleform

How to use the "Actor.create" function in Scaleform

Anonymous
Not applicable
1,488 Views
9 Replies
Message 1 of 10

How to use the "Actor.create" function in Scaleform

Anonymous
Not applicable

I'm trying to autopopulate a menu with buttons using the "Actor.create" function, but I'm getting a little confused as to how to implement it.  If I have a prototype of the object I'm trying to replicate, how do I access it using the create function?  It accepts a parent container, and a table.  How to do I feed the prototype object in as a table?

Reply
Reply
0 Likes
Accepted solutions (1)
1,489 Views
9 Replies
Replies (9)
Message 2 of 10

dan.matlack
Alumni
Alumni
Hi biotic,

'create' makes a new Actor, can add to the parent and can create any child components. There is some documentation here at Scaleform Studio help :

chrome-extension://hehijbfgiekmjfkfjpbkbammjbdenadd/nhc.htm#url=http://help.autodesk.com/view/ScaleformStudio/ENU/?guid=__lua_ref_obj_scaleform_Actor_html

I will also check with the team and see if we can offer any specific help on this for you. 🙂
______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.
Reply
Reply
0 Likes
Message 3 of 10

dan.matlack
Alumni
Alumni
Also, could you explain what you mean by 'prototype object'?
______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.
Reply
Reply
0 Likes
Message 4 of 10

Anonymous
Not applicable

I mean an object I've already created in the scaleform scene, like a button.

Reply
Reply
0 Likes
Message 5 of 10

Anonymous
Not applicable

I'm trying the "scaleform.Actor.load("filepath")" function instead now, since it seems to be a better way to do this.  The path can lead to a template Actor that's been saved previously.  Unfortunately, I can't seem to get the template to load, here's my code

 

 if (e.name == "MENU") then
        local newButton = scaleform.Actor.load("content/ui/simple_menu.s2d/Start_Button.s2dactor")
        newObjects[1] = newButton
        newPoint = {x=160, y= -60}
        scaleform.Actor.set_local_position(newObjects[1],newPoint)
    end

It's giving me this error

Test Engine / Scaleform Studio: Error: ...i/simple_menu.s2d/Scripts/main_menu_keyboard_handler.lua:179: Error attempting to load 'content/ui/simple_menu.s2d/Start_Button.s2dactor'

What am I doing wrong here

Reply
Reply
0 Likes
Message 6 of 10

dan.matlack
Alumni
Alumni
The path should be relative to the scaleform project.
______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.
Reply
Reply
0 Likes
Message 7 of 10

Anonymous
Not applicable

I guess this is where I'm stuck.  Do I put the full file path "D:/stingRay_projects/demo_one/content/ui/simple_menu.s2d/Start_Button.s2dactor" ?  Or is there some other path I'm supposed to be using?

Reply
Reply
0 Likes
Message 8 of 10

dan.matlack
Alumni
Alumni
the file path should start in the directory where the ui project is. Make sense? so if your project is in "D:/stingRay_projects/demo_one/content/ui/" then the path would be "simple_menu.s2d/Start_Button.s2dactor"
______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.
Reply
Reply
0 Likes
Message 9 of 10

Anonymous
Not applicable

That still generates an error.  Here's my code now

 if (e.name == "MENU") then
        local newButton = scaleform.Actor.load("simple_menu.s2d/Start_Button.s2dactor")
        newObjects[1] = newButton
        newPoint = {x=160, y= -60}
        scaleform.Actor.set_local_position(newObjects[1],newPoint)
    end

and here's the same error basically

Test Engine / Scaleform Studio: Error: ...i/simple_menu.s2d/Scripts/main_menu_keyboard_handler.lua:179: Error attempting to load 'simple_menu.s2d/Start_Button.s2dactor'

I'm unsure as to why it's still logging an error.

Reply
Reply
0 Likes
Message 10 of 10

dan.matlack
Alumni
Alumni
Accepted solution
 if (e.name == "MENU") then
        local newButton = scaleform.Actor.load("Start_Button.s2dactor")
        newObjects[1] = newButton
        newPoint = {x=160, y= -60}
        scaleform.Actor.set_local_position(newObjects[1],newPoint)
    end

Above should be correct, that was my fault from previous post. It should be relative to where the project lives and it lives in the .s2d folder so you don't have to include that.

______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.
Reply
Reply
0 Likes