I made a drawing in Illustrator and exported it as FXG file to be used in my Flex App which is working fine. But now I want to change some settings inside FXG programatically, namely changing color inside the FXG file. How do I do that?
If you are using a .fxg file you won't be able access anything inside of the file since the compiler optimizes it. You can almost think of it as an image file that can scale. Sounds like you might want to be using MXML Graphics, see this post for an explanation of the difference: http://help.adobe.com/en_US/flex/using/WS145DAB0B-A958-423f-8A01-12B679BA0CC7.html
Related
I'm trying to add a SVG into my webpage, I think the format is a bit odd.
https://gist.github.com/Vadorequest/c329dec26e39a586e96df5f74c1d7d29?short_path=d29c6c9 (you can see the source code and the rendering there)
The style part isn't correctly understood since I'm loading this file using React. If you save the file and open it in a browser, it'll work fine. But if I load it by react using react-svg-loader, it displays a dark image.
import IconBook from "-!react-svg-loader!../assets/couverture-eBook-VF.svg";
...
<IconBook height={250} />
Is it standard to put the style like this? Should I get a new SVG exported differently? I really don't know that format and all its possibilities.
Edit 1:
I found a working workaround for anyone interested: https://github.com/gilbarbara/react-inlinesvg
It basically loads the svg file over network and anything in it will be correctly loaded. (including <styles>)
On the bad side, it makes the app rely on something that must be available via CDN or alike. (you won't have the svg embedded in your app. If you wanted some kind of standalone app that can be built with everything in it, it's not really good)
On the good side, it doesn't require any change in the SVG file, you use it as it, load it over network, and it displays as in the browser.
Since I'm building a standalone app (basically, npm run build will generate a folder with my whole app) this isn't perfect because I need to host that file somewhere on a CDN. So I'll keep looking for another solution.
It is fine to have styles in your svg file, as specification says:
Cascading Style Sheets (CSS) is a stylesheet language used to describe
the presentation of a document written in HTML or XML (including XML
dialects such as SVG or XHTML). CSS describes how elements should be
rendered on screen, on paper, in speech, or on other media.
https://developer.mozilla.org/en-US/docs/Web/CSS
I have made one large project using Qt designer which has .ui, .cpp, .h files.
Now I want to add colors and tool-tip to pushbuttons of all .ui files in one go or some easy way, because it WOULD BE VERY DIFFICULT TO GO THROUGH ALL .ui files and change color of each pushbuttons.
Is there anyway I can do this?
If you are not sure you can share your ideas.
Please.
You can try to use Qt Style Sheets to customizing your widgets across your application. For example, to set background color for all QPushButtons in your application add such code:
qApp->setStyleSheet("QPushButton { background-color: yellow }");
Qt Style Sheets Reference
One way would be to use suitable editor with "Find and replace in files", or sed/perl/awk if you prefer command line. Use this on the .ui files (they are XML). First figure out the search which finds you the right places, and then do the replacement. If you need to replace just a specific string (defining the color), then you don't even need regexps.
Warning: The .ui files are not really meant to be hand-edited. Therefore it is fairly easy to break them so that Designer can no longer work on them. But there's no magic in this, they're just text files which can be edited, Designer just expects them to be exactly like it wants them and doesn't allow for mistakes often introduced by hand editing. Just be sure to change only the color value string and nothing else, and have an unedited backup (ie. version control), and you should be fine.
Note that Qt Creator refuses to edit .ui files as text, because they are so easy to break by hand-editing, so you probably want to use some other editor (Notepad++ is a common free Windows alternative).
However, I would recommend first trying with style sheets, as said in the other answer. Only if that proves to be impractical, then you should consider this option. The big benefit of style sheets is, if you need to do another change, then it's much less work, than doing another search-replace.
Is it possible to use png files in QwtPlot? Normally i can use svg files in my plots with QwtPlotSvgitem class but i could not succeed with these png files. Please give me a clue about that.
Regards
Probably there are several ways to do this. You don't specify what kind of image you want to draw (and where).
You might create a QwtPlotMarker (Qwt docs) with a custom QwtSymbol (Qwt docs). You can try QwtSymbol::setPixmap(). A QPixmap can be created by calling its constructor with the file name of the *.png image (Qt docs).
I've a flex application which has actionscript file, images. When i run this in adobe flash builder, everything works. When i export it as a release build and run in other file, swf does not show images and interactivity of flex components is also lost.
Is there a specific way to embed images?
Here is image code,
I don't see your code, but I've had similar issues before. The trick is to reference the image starting with a forward slash '/' in the path. For example, if the image is located at 'img/test.png' then use '/img/test.png' as the embed source path. You should also check to make sure the image is included in your build path.
Has anyone got experience in converting AS3 projects (no mxml) in Flex, to Flash CS4? Are there any resources out there as to what works in Flex Builder that doesn't work in Flash, and how to get the project running? I read somewhere that (for instance) certain Metadata tags don't work.
If I've got all my code in the src folder, should I just create the .fla file in that folder and basically copy all code from the .as file which launched the Flex project? Or create the .fla file somewhere else and point assign that src folder in the classpath? Also, not being familiar with the CS4 IDE, do I create a new Flash Project?
Thanks!
So here's the issue I'm having. The code in the Flex AS3 looks like this:
[Embed(source='C:/WINDOWS/Fonts/ArialBD.TTF', fontWeight = 'bold', fontName='ArialBold', unicodeRange='U+0020-U+0020,U+0021-...')] //a bunch of other unicode
public static var _VerdanaFontBold:Class;
[Embed(source='C:/WINDOWS/Fonts/Arial.TTF', fontWeight = 'regular', fontName='Arial', unicodeRange='U+0020-U+0020...')] //a bunch of other unicode
public static var _VerdanaFont:Class;
And in constructor of the extended textfield in which my text appears I have:
Font.registerFont(_VerdanaFontBold);
Font.registerFont(_VerdanaFont);
CS4 doesn't allow use of the Embed metadata. So I've commented that out. In CS4, I understand that I'm supposed to create a blank textfield in design mode, which I've done. I then can select fonts to embed. I've selected verdana (upper and lower case, punctuation, number, etc).
When I run the app in CS4, the textfield is blank.
What am I doing wrong? Do I need to give the verdana font an instance name of _VerdanaFont? I wouldn't think so, since I've had to comment out the Font.registerFont as well. The fact that I'm embedding the font in a blank textfield, and not the one that's called by the document class I've set, shouldn't matter, right -- the font should just be embedded in the swf and available for use. But it's blank.
Does anyone know what to do here?
Edit: Well given that the apparent reason this isn't working now has to do with fonts not showing up correctly, I better create that as a new Question. Also, there's a clearer description than the one in the link provided above regarding the document class, here: http://www.heaveninteractive.com/weblog/2008/03/04/introduction-to-the-document-class-in-actionscript-30-tutorial/
It really depends. If it's just a pure AS3 project that relies only on playerglobal.swc it should be fairly easy. Just copy your .as files and add them to your new project as Cameron has suggested.
If however you've written a pure AS3 Flex app that relies on any of the other SWCs (flex.swc, framework.swc, etc) it's not really possible, as CS4 can't use SWC files. If you google around you might find somebody who's disassembled the SWC into various .abc files and a SWF full of resources, but you'll probably end up having to embed the entire Flex framework and all support code into your final SWF, which will bloat it big-time.