Skip to main content
Participant
March 8, 2021
Question

I am trying to add component into specific movieClipName

  • March 8, 2021
  • 1 reply
  • 99 views

and it's not working.

here is the code:

var movieClipName = 'main'
var component = 'Retailigence Ladybug (Compact)'
var base = fl.configURI.split("Users")[0];
fl.runScript(base+'/Users/yuval/Tremor/CreativePython/createenvcreative/scripts/config.jsfl');
var componentPanel = blinkComponents
var layerBefore = 'Bug'
var parameters = {}
parameters['retailerid'] = 'f4b57e8f-1538-4cd3-8971-ed9ee0b44cbb, 21992066-3a78-4797-a82d-2ea8ae5356c7, 5a41ddd9-fb0c-4e2f-88cc-9015ccb1144b, 19b5eaaa-1f71-40b5-9701-8bd4b163b363, 8700a410-cd23-440a-aeab-2aea7fc1e95d, 1a91fa7e-96af-4cd7-84c3-fcd0d6799241, e57dbeb1-ce01-4cde-b223-a93e0c8bd158, abe3d757-6a09-49ef-a971-dd26fd478aa6, 05d16795-cded-4ae1-82d6-3f6b9a452610, 2034938e-e9ff-4228-9679-81388a8dff14, 78102105-c814-4c37-a4de-82d7bc461b74, 05d16795-cded-4ae1-82d6-3f6b9a452610, 3baf6d91-e9f0-42b2-ac74-c68bfa303bb6, 102aff7a-c831-47ea-b976-9dd6e4468b43, 06b2126a-93cd-4127-afe0-9e370382b1d3, 2f1be15a-6a89-4947-ad73-e3d7967b3b8a, 2a07c9ae-aac8-4893-9853-4e4e467bde22, e2008de9-7465-4216-9ab4-ea8d16cc00e5, a6983fd3-6707-41bf-ab02-02f0c9a274a9, 9b195320-bfca-455d-bf40-2fbfe017ecaf, 654d8463-a9c4-4e3d-a8d8-973f22dcf7cd, 0688e199-6bd5-48f4-86dc-da1155a2b3bd, 0e2528af-79b6-41db-8cf0-172237492e13, 4f6ccffc-0b24-44dc-bdc4-aaa00c408cf5'
var attributes = {}
attributes['name'] = 'retailigence_ladybug_compact_inst'
attributes['width'] = 200
attributes['height'] = 125
attributes['x'] = 440
attributes['y'] = 235

// Add as many components to as many layers as you want:

// Set lastStep = true on the last call to addComponentToMovieClip, which will close animateCC after saving
// the file
var lastStep = false
CCLib.addComponentToMovieClip(component, componentPanel, movieClipName, layerBefore, parameters, attributes, lastStep)

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    March 8, 2021

    i have no idea where that came from and you're only showing part of the code (not that i want to see more).

     

    to add a component to a movieclip with jsfl, you would select the movieclip (there are several ways), enter edit mode and then add the component and exit edit mode (if you're done editing the movieclip).  eg, if you're creating a new movieclp and wanted to add a scrollpane to it:

     

    var lib = an.getDocumentDOM().library;
    lib.addNewItem('movie clip');
    if (lib.getItemProperty('linkageImportForRS') == true) {
    lib.setItemProperty('linkageImportForRS', false);
    }
    else {
    lib.setItemProperty('linkageExportForAS', false);
    lib.setItemProperty('linkageExportForRS', false);
    }

    an.getDocumentDOM().enterEditMode('');
    an.componentsPanel.addItemToDocument({x:42, y:31.1}, 'User Interface', 'ScrollPane');
    an.getDocumentDOM().exitEditMode();