ThomasLewis Posted March 30, 2012 Share Posted March 30, 2012 Moving frames in Javascript In FusionPro Producer (formerly FP Direct or FP Server), the ability to move a frame’s position and size can be controlled in JavaScript using the OnRecordStart callback rule. Can I get a pointer to where I find the documentation for this? It appears that the language reference guide that installs with FP8 hasn't been updated to include this (and still says Copyright 2011). FindTextFrame("name").x = val; is apparently not the way to do it. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 2, 2012 Share Posted April 2, 2012 Can I get a pointer to where I find the documentation for this? It appears that the language reference guide that installs with FP8 hasn't been updated to include this (and still says Copyright 2011). FindTextFrame("name").x = val; is apparently not the way to do it. That is indeed the way to do it. Although you need to have a FusionPro 8 VDP Producer (Direct or Server) license. If you have a 7.2 or earlier license, or a VDP Creator (Desktop) license, it won't work, although you can upload your job to a FusionPro 8 VDP Producer system such as MarcomCentral and compose it there to move frames. As for the documentation, the copyright date for FusionPro 8 may still say 2011, but it's the right doc. (Look for a section about arbitrarily adjusting stacking.) I'll look into the documentation for the frame API specifically and figure out what happened to that. Note that the Building Blocks dialog fully documents the frame API, on the Objects tab under "Frames." Quote Link to comment Share on other sites More sharing options...
Lauren Posted April 2, 2012 Share Posted April 2, 2012 In the v8.0 User Guide, there is a paragraph addressing this new functionality at the bottom of p.232. It states, You can resize and move text and graphic frames by changing their properties in JavaScript in OnRecordStart. Note, however, that this will only work for the FusionPro Producer (formerly known as FP Direct and FP Server products.) If used with the Designer or Creator (aka Desktop) tool, then the moved/resized frames will be highlighted in the output, and an error message is generated to indicate that the Producer software is required to create final output of moved frames. To use this new functionality you would use the OnRecordStart callback rule. Here is an example of code that could be used within it:var frame = FindTextFrame("TextFrame1"); //set this value to the name of the frame var NewHeight = 36000; //5 inches specified in hundreths of a point var NewWidth = 21600; //3 inches specified in hundreths of a point var NewX = 21600; //3 inches specified in hundreths of a point var NewY = 28800; //4 inches specified in hundreths of a point frame.height = NewHeight; frame.width = NewWidth; frame.x = NewX; frame.y = NewY;I have also attached a sample job that uses this code.Move Frame.zip Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted April 2, 2012 Author Share Posted April 2, 2012 I'm using Desktop but it will be composed on MarcomCentral. I guess I was under the impression that the frame itself would move in the preview. I see now that the contents do move but the frame doesn't, I just had to make the frame bigger to see it. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 2, 2012 Share Posted April 2, 2012 (edited) I'm using Desktop but it will be composed on MarcomCentral. I guess I was under the impression that the frame itself would move in the preview. I see now that the contents do move but the frame doesn't, I just had to make the frame bigger to see it. I'm not sure what you mean by, "the contents do move but the frame doesn't." The entire frame should move in Preview, although if you don't have a Producer license, the frame will have a random border and fill applied. It might help if you could post a sample job or a screenshot of what you're seeing. We do want to know about any issues with this new functionality. Edited April 2, 2012 by Dan Korn Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted April 2, 2012 Author Share Posted April 2, 2012 Please see attached. It's not a big deal, I just didn't notice it at first so I didn't think I got the JavaScript right. I do see that 6 point border being an issue though as positioning of the text will be off when that's gone. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 3, 2012 Share Posted April 3, 2012 (edited) Please see attached. It's not a big deal, I just didn't notice it at first so I didn't think I got the JavaScript right. I do see that 6 point border being an issue though as positioning of the text will be off when that's gone. I see. The frames may not appear in Preview if they don't overlap other frames, as the Preview system is based on the locations of the original frames, and doesn't know that they've been moved. You pretty much need to do a regular (non-Preview) composition to see frames which have been moved significantly in JavaScript. The other option is to place an empty frame over the entire page, which will force the entire page to be redrawn in Preview. Edited April 3, 2012 by Dan Korn Quote Link to comment Share on other sites More sharing options...
jreynolds Posted October 31, 2012 Share Posted October 31, 2012 So I got my text frames to move correctly thanks to this thread, but now I need to know how to move them based on a variable in a field, but to leave them "as is" otherwise. Here's my statement now that isn't working. I need to center 3 frames when a currency field has zero cents: if ((Right("Price-2for"),2) == "00"); return { FindTextFrame("K (Price n for)").x = 8776 FindTextFrame("K (Price n for)").y = 6235 FindTextFrame("J (Qty n for)").x = 3996 FindTextFrame("J (Qty n for)").y = 4053 FindTextFrame("J (For only)").x = 8374 FindTextFrame("J (For only)").x = 4025 } Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted October 31, 2012 Author Share Posted October 31, 2012 It's hard to tell without seeing exactly what you are doing but this JavaScript might be a little closer to what you intended: if (Right(Field("Price-2for"),2) == "00") { FindTextFrame("K (Price n for)").x = 8776; FindTextFrame("K (Price n for)").y = 6235; FindTextFrame("J (Qty n for)").x = 3996; FindTextFrame("J (Qty n for)").y = 4053; FindTextFrame("J (For only)").x = 8374; FindTextFrame("J (For only)").x = 4025; } Quote Link to comment Share on other sites More sharing options...
step Posted October 31, 2012 Share Posted October 31, 2012 I'm guessing that this change needs to be made so that there isn't conflicting information for the x position of the "J (For only)" text box: if ((Right("Price-2for"),2) == "00"); return { FindTextFrame("K (Price n for)").x = 8776 FindTextFrame("K (Price n for)").y = 6235 FindTextFrame("J (Qty n for)").x = 3996 FindTextFrame("J (Qty n for)").y = 4053 FindTextFrame("J (For only)").x = 8374 [color="Red"]FindTextFrame("J (For only)").y = 4025[/color] } Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted October 31, 2012 Author Share Posted October 31, 2012 Good catch. I think the bigger problem is that Right("Price-2for"),2) will always = "or" as its a literal string. Quote Link to comment Share on other sites More sharing options...
jreynolds Posted October 31, 2012 Share Posted October 31, 2012 That was it, Thomas, muchas gracias! I did have to correct just one little error from my original post where I had switch an 'x' coordinate to a 'y'. FindTextFrame("J (For only)").[color=red]y[/color] = 4025; Other than that, it worked great. Quote Link to comment Share on other sites More sharing options...
ReminderVDP Posted January 10, 2013 Share Posted January 10, 2013 In order to change the size of the frames to fit 3 different sized images, how would you change that in the Javascript? Basically, I need a work-around for the inability to wrap text to an image like Runaround in Quark. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.