Me again! Anyone have a good resource for learning more about modules?I have a module in a project but I would like to position it to whatever location I desire. I'd also like to duplicate it within the project?
The answers to your questions depend on how the module was written. Code would help in this case.
Hi Chris Camargo, Here's a real basic example. I want to create a layer in my module. include it in my project, change it's x,y co-ordinates and make a copy
exports.button1 = new Layer width: 150 height: 150 x: 100 y:100
module = require "myModule"
module.button1 x:400 y:400
but when i reference with module.button1 framer throws an error
I can upload the framer file but that's really it to get me started
here is an example how you could use a module for a button: http://share.framerjs.com/rclf3edh6esq/
The trick is that you use a function to draw the button and define the Events so you can use it again. If you are not familiar with functions than this should be your next step to learn.
That's great Antonio Krämer Fernandez! I see now how it needs to be a function, makes sense. I'll get to it
working great, got it figured out, thanks!
So say I want to access part of a function, how would I do that, based on your example? I tried it in this project but to no avail...
one way is by adding an Array that stores all buttons so its possible to access them later.http://share.framerjs.com/yg1o32x7mzp5/
Everytime the function is called it pushes the new button into the array allButtons.
ah, very cool. Although what I intended to do was to change the text on the buttons themselves, via the changeHTML layer...
so that when you click the blue layer. the button that says "start" changes to saying "hello". or the background colour would change, for instance
ah then you just need to switch it around: changeHMTL.on Events.Click, -> module.allButtons.html = "hello" module.allButtons.html = "hello"