Can ExtendScript replace a FootageItem with an Illustrator file and specify a certain layer? - extendscript

In AfterEffects, I can right click on a file in the Project panel, then select "Replace Footage". After choosing an Illustrator file, the window below appears, which allows me to select a particular layer from that Illustrator file.
Is it possible to replace a FootageItem using ExtendScript and specify a certain layer of an Illustrator file?
Basics on the documentation, I've only found the FootageItem.replace( ) method. However, when I use this method, I'm unable to specify a layer of the Illustrator file.

From the scripting guide:
app.project.item(index).layer(index).replaceSource (newSource, fixExpressions)
Description:
Replaces the source for this layer.
Parameters:
newSource
The new source AVItem object.
fixExpressions
True to adjust expressions for the new source, false otherwise. Note that this feature can be resource-intensive; if replacing a large amount of footage, do this only at the end of the operation. See also "Project autoFixExpressions() method" on page 115.
Returns: Nothing.
So I guess you should do two steps.
Import your .ai file via new ImportOptions(file);
replace the source of your AVLayer

Related

How to Embed text file in Adobe Flash for Adobe Air application

I've been searching for several days now a way to embed a data file, which is in text format, inside an app I'm trying to build in Adobe Flash for Adobe Air (for Android for now). The text file has a lot of data I want to use in my app, so I want to embed it inside the app, so when the app launches I can use it.
I've been reading about how to read and write text file in Flash and Adobe Air, but couldn't find a way to add this file to be part of my app. The Adobe Flash Library that is used for saving various assert (File > Import > Import to Library), doesn't support text file (only image, sound, video, and other graphic formats). Is there an other way to add a different (i.e. Text) file to the app?
As a last resort, and to help me proceed with the implementation, I tried manually copying the file to the Android "Documents" folder, and reading it from the app using this:
var myFile:File = File.documentsDirectory.resolvePath("MyText.txt");
var fileStream:FileStream = new FileStream();
fileStream.open(myFile, FileMode.READ);
var fileContents:String = fileStream.readUTFBytes(fileStream.bytesAvailable);
This worked on the PC when testing, but on Android it couldn't find my text file. I placed it in "My Files > Internal storage > Documents" (on Samsung phone). Is there a different "Documents" folder I should use to be found by documentsDirectory.resolvePath() function...
Anyway, as said, this was last resort solution, and much less preferred, because I don't want the users of my app to need to copy internal data files for the app to work, it should be part of the APK... So embedding the text file somehow inside the app is a much better solution, but I couldn't find a way to do that.
Thanks Organis for your answer, I didn't yet try it but I guess it should work.
I found another answer few hours ago, and will share it now, in case someone else encounters this problem.
You could embed a file from the "Publish Settings" dialog, then going into "AIR for Android Setting" (small wrench icon). On the "AIR for Android Setting" under "General" tab, at the bottom there is "Include files". You can click the [+] icon and add any file you want.
From the code you can access this file using standard file read method, using URLLoader & URLRequest functions and Event.COMPLETE to get the data when the file finishes loading.
see screenshot here

Recognised file types for image preview?

Is it possible to add additional file types to be recognised as images and thus trigger automatic creation of an image view when a resource is uploaded?
SVG files will preview in CKAN, but we have to manually add the image view e.g.
https://datastore.landcareresearch.co.nz/dataset/novel-yeasts-from-new-zealand-forests/resource/3812ee6b-dd45-45c9-b425-6a18375e5727
With text (for example) we can specify file format extensions to recognise as text and automatically create a text preview (ckan.preview.text_formats...). Is there an equivalent for images?
Thanks
It would only be possible by modifying the source code for your instance:
https://github.com/ckan/ckan/blob/master/ckanext/imageview/plugin.py#L9
Seems like a great idea to have the image view on a par with the text view in this regard, so I made a pull request:
https://github.com/ckan/ckan/pull/3380

Create a map with clickable provinces/states using SVG, HTML/CSS, ImageMap

I am trying to create an interactive map where users can click on different provinces in the map to get info specific to that province.
Example:
archived: http://www.todospelaeducacao.org.br/
archived: http://code.google.com/p/svg2imap/
So far I've only found solutions that have limited functionality. I've only really searched for this using an SVG file, but I would be open to other file types if it is possible.
If anyone knows of a fully functioning way to do this (jQuery plug-in, PHP script, vector images) or a tutorial on how to do it manually please do share.
jQuery plugin for decorating image maps (highlights, select areas, tooltips):
http://www.outsharked.com/imagemapster/
Disclosure: I wrote it.
Sounds like you want a simple imagemap, I'd recommend to not make it more complex than it needs to be. Here's an article on how to improve imagemaps with svg. It's very easy to do clickable regions in svg itself, just add some <a> elements around the shapes you want to have clickable.
A couple of options if you need something more advanced:
http://jqvmap.com/
http://jvectormap.com/
http://polymaps.org/
I think it's better to divide my answer to 2 parts:
A-Create everything from scratch (using SVG, JavaScript, and HTML5):
Create a new HTML5 page
Create a new SVG file, each clickable area (province) should be a separate SVG Polygon in your SVG file,
(I'm using Adobe Illustrator for creating SVG files but you can find many alternative software products too, for example Inkscape)
Add mouseover and click events to your polygons one by one
<polygon points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1"
onmouseover="mouseOverHandler(evt)"
onclick="clickHandler(evt)" />
Add a handler for each event in your JavaScript code and add your desired code to the handler
function mouseOverHandler(evt) {};
function clickHandler(evt) {};
Add the SVG file to your HTML page (I prefer inline SVG but you can use linked SVG file too)
Upload the files to your server
B-Use a software like FLDraw Interactive Image Creator (only if you have a map image and want to make it interactive):
Create an empty project and choose your map image as your base image when creating the new project
Add a Polygon element (from the Shape menu) for each province
For each polygon double click it to open the Properties window where you can choose an event type for mouse-over and click,
also change the shape opacity to 0 to make it invisible
Save your project and Publish it to HTML5, FLDraw will create a new folder that contains all of the required files for your project that you can upload to your server.
Option (A) is very good if you are programmer or you have someone to create the required code and SVG file for you,
Option (B) is good if you don't want to hire someone or spend your own time for creating everything from scratch
You have some other options too, for example using HTML5 Canvas instead of SVG, but it's not very easy to create a Zoomable map using HTML5 Canvas,
maybe there are some other ways too that I'm not aware of.
Just in case anyone will search for it - I used it on several sites, always the customization and RD possibilities were a perfect fit for what I needed. Simple and it is free to use:
Clickable CSS Maps
One note for more scripts on a site: I had some annoying problems with getting to work a map (that worked as a graphic menu) in Drupal 7. There where many other script used, and after handling them, I got stuck with the map - it still didn't work, although the jquery.cssmap.js, CSS (both local) and the script in the where in the right place. Firebug showed me an error and I suddenly eureka - a simple oversight, I left the script code as it was in the example and there was a conflict. Just change the front function "$" to "jQuery" (or other handler) and it works perfect. :]
Here's what I ment (of course you can put it before instead of the ):
<script type="text/javascript">
jQuery(function($){
$('#map-country').cssMap({'size' : 810});
});
</script>
Go to SVG to Script
with your SVG the default output is the map in SVG
Code which adds events is also added but is easily identified and can be altered as required.
I have been using makeaclickablemap for my province maps for some time now and it turned out to be a really good fit.
I had the same requirements and finally this Map converter worked for me. It is the best plugin for any map generation.
Here is another image map plugin I wrote to enhance image maps: https://github.com/gestixi/pictarea
It makes it easy to highlight all the area and let you specify different styles depending on the state of the zone: normal, hover, active, disable.
You can also specify how many zones can be selected at the same time.
The following code may help you:
$("#svgEuropa [id='stallwanger.it.dev_shape_DEU']").on("click",function(){
alert($(this).attr("id"));
});
Source
You have quite a few options for this:
1 - If you can find an SVG file for the map you want, you can use something like RaphaelJS or SnapSVG to add click listeners for your states/regions, this solution is the most customizable...
2 - You can use dedicated tools such as clickablemapbuilder (free) or makeaclickablemap (i think free also).
[disclaimer] Im the author of clickablemapbuilder.com :)
<script type="text/javascript">
jQuery(function($){
$('#map-country').cssMap({'size' : 810});
});
</script>
strong text

silverstripe - adding styles to 'styles' drop down menu on editor

from the question above, I thought it would be relatively easy but i can not find any documentation on on how to add styles to the 'styles' drop down menu. can anyone push me in the right direction?
The styles dropdown is automatically populated based on classes found in your theme's typography.css file. To add classes, just ensure that they are defined there. Alternatively, if you want to give the classes friendlier names or to remove some classes from the list, you can explicitly define the styles that you want listed by putting this in your _config.php file.
HtmlEditorConfig::get('cms')->setOption('theme_advanced_styles',
'Name 1=class1;Name 2=class2');
It's a feature provided by TinyMCE, the WYSIWYG editor component, and this line is just setting the theme_advanced_styles setting of TinyMCE when used by the CMS. This thread on the TinyMCE site also discusses it.
Also note Markus' answer below: editor.css needs to be in the theme css folder and include the typography.css.
The answer of #Sam Minnée only works, if the editor.css is also in the theme css folder and includes the typography.css.
Here is a more detailed description of how these two play together.
If you have troubles getting the new styles appear in the editor, try the following:
yoursite.com/admin/?flush=1
Check the file permissions on your mythemes/css/editor.css file. It should be readable by the webserver user.

Expression Blend's default LayoutRoot

Is there a way to change the default LayoutRoot type in Expression Blend 3? Currently, I'm prototyping in SketchFlow, and I prefer Canvas over the Grid, and it's annoying to change it for every new screen.
Here is answer that will work, but you will need to change the templates:
Back up the contents of the template directory which resides here:
%ProgramFiles%\Microsoft Expression\Blend 3\Templates\
Find the templates being used in:
%ProgramFiles%\Microsoft Expression\Blend 3\Templates\(CSharp|VisualBasic)\
In that directory there will be 4 relevant templates:
SketchFlowCompScreen,
SketchFlowCompScreenSL,
SketchFlowNavScreen,
SketchFlowNavScreenSL
If you edit the xaml files within these, whenever you create a new screen in SketchFlow the screens will use your changes.

Resources