I use google swiffy for convert my swf file to html5.
But now google is upgraded runtime to v 5.2 and can't use transparent background.
Before i use runtime v 4.9 of google swiffy html5 from swf file and in google code i remove this from my javascript file for use transparenty background:
"backgroundColor":-1,
But now runtime is upgraded to v5.2 and i can`t remove background color from swiffy file
https://www.gstatic.com/swiffy/v5.2/runtime.js
This solution work perfectly with flash cs5 -> swiffy v5.3!
#swiffycontainer rect {
background: none !important;
display:none !important;
}
To expand this answer: I'm running Swiffy 5.2.0 and this didn't work at the very beginning since the internal generated code is different in my case, it looks like this:
<div id="my-container">
<!-- Begins Swiffy generated code -->
<div style="position: relative; height: 100%; overflow: hidden; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); background-color: rgb(102, 121, 14); cursor: default; background-position: initial initial; background-repeat: initial initial;">
<svg color-interpolation-filters="sRGB" style="fill-rule: evenodd; pointer-events: none; -webkit-user-select: none; width: 100%; height: 100%;">
<!-- svg contents here -->
</svg>
<!-- Ends Swiffy generated code -->
</div>
</div>
Note that my-container is the container that I assigned in the stage constructor, not generated by Swiffy.
Just check for the generated code and adjust css selector as necessary, the original idea still remains the same:
<style type="text/css">
#my-container div {
background-color: transparent !important;
}
</style>
Roger's solution worked perfectly for me: I'm using Swiffy in a Wordpress Environment, so here's what I did:
1) Add the Swiffy-generated code into the header.php file (actually header-home.php so I could call it for only one page).
2) Before the Swiffy , add Roger's code:
<style type="text/css">
#swiffycontainer div {
background-color: transparent !important;
}
</style>
3) Place the Swiffy-generated code that came AFTER the (before the close of the tag) into the footer.php file (again, footer-home.php in my case).
4) Put the Swiffy container ('id="swiffycontainer"' by default) Div on the WordPress page.
Tah-Dah! I would have simply voted Roger up, but I don't have the rep to do so. Plus I thought my WordPress situation might help others.
<style type="text/css" media="screen">
#div *:first-child {
background-color: transparent !important;
}
</style>
GOOGLE HAVE THE ANSWER:
https://www.google.com/doubleclick/studio/swiffy/faq.html
How can I make the background transparent?
If you need to make the background transparent, as done by the wmode="transparent" attribute, you can insert the following code snippet in the Swiffy output, just before the call to stage.start():
stage.setBackground(null);
You can also replace the null with any valid CSS color specification string to override the background color from the one defined in the conversion.
After searching and searching in the web, and try everything, also described in this post, finally I've find the solution!!
When you export and .swf in flash CS6 to html5 (canvas), open the .html file exported in a html editor and change the background-color attribute to #transparent"
Example:
<body onload="init();" style="background-color:#transparent">
<canvas id="canvas" width="550" height="300" style="background-color:#transparent"></canvas>
</body>
Well, it works fine for me!
You can invoke the "setBackground" method to null after starting up the stage. Like so,
stage.start();
stage.setBackground(null);
Related
I would like to set a background image to a div using CSS.
While I can display the image while using HTML <img src="/static/img/fon1.jpg">...
I get a 404 (Not Found) when I try to set the image through CSS:
style="background-image: url(/static/img/fon1.jpg)"\
I have tried different paths like: ../img/fon1.jpg and many others. Also with and withoud quotes.
I am certain that the css and the html are linked correctly as I can set the background to a solid color.
If I use in html, the css elements find and display the picture as well.
I feel like I should resort to just using <img> and rescaling it to fit the window, but I'd like to know what's wrong with the sucker.
Any kind of help / materials / links / jokes are welcome. Thank you if you take your time. All the best!
Folder structure:
project
└─static
└─ img
| fon1.jpg
└─ stylesheet
| styles.css
└─ base.html
HTML
<link rel="stylesheet" type="text/css" href="/static/stylesheet/styles.css">
...
<body>
<div class="background1"></div>
<div class="background2" style="background-image: url('/static/img/fon1.jpg')"></div>
</body>
...
CSS
.background1 {
background-image: url(../img/fon1.jpg);
height: 960px;
width: 1280px;
}
.background2 {
background: red;
height: 960px;
width: 1280px;
}
You missed the quotes in your code.
.background1 {
background-image: url('../img/fon1.jpg');
height: 960px;
width: 1280px;
}
I believe the proble lies in JetBrains Webstorm application. I tried the same configur on another application where I was hosting the server, and then the images were found. Currently I was using Webstorms feature to open local HTML file in browser. Seems that it doesnt support GET requests from .css file.
Update:
When referencing static files in Webstorm Live Edit the path should include the project folder. In my case the img would be located at: http://localhost:63342/projectname/static/img/fon1.jpg
I don't know from which file you are trying to access the image. I am assuming, You are trying from base.html
you are able to add the image like this.
<img src="./img/fon1.jpg">
I am trying to load a local image as background image in CSS. My folder structure as below,
MyApp
Public
index.html
html
template.html
images
myimage.png
javascripts
stylesheet
Loading index.html from public folder and on click, loading template.html from html folder. In template.html i have defined the css like this,
textarea{
<!-- background-image: url(http://i.imgur.com/2cOaJ.png); -->
background-image: url('../images/myimage.png');
background-attachment: local;
background-repeat: no-repeat;
padding-left: 35px;
padding-top: 10px;
border-color:white;
background-color: white;
height:90%;
width:95%;
resize: none;
outline-width: 0;
}
And calling this in template.html as ,
<div id="bodydata" class="tabcontent" >
<textarea rows="5" ng-model="description"></textarea>
</div>
It works beautifully when I take an image from web "background-image: URL(http://i.imgur.com/2cOaJ.png);" but does not work when I change to the local image which is nothing but the same image downloaded and saved as the local copy.
background-image: url('../images/myimage.png');
I want to have it as local because the server may not have the internet connection. So how to refer the image in right way. I have tried many things like single quotes, double quotes, without quotes but it didn't work. Please suggest.
Thanks in advance.
How is your web-server setup? Where is your web-server running from?
Depending on these answers, you should be able to achieve the desired result by adjusting your CSS like this:
background-image: url('/images/myimage.png');
So for instance, if your web-server is running in /MyApp, and is configured to allow static files to be fetched (eg files matching this pattern /images/*.png), then the answer above should work.
I am developing a small web application in which I have an object element (that contains an embed) that I use to display small documents.
The documents can be PDFs or plain text files (.txt) that I get from a web service in the form of a base64 string. Then, to show the content, I update the data and src attributes for the object and embed respectively. The final result would look something like this (simplified):
object {
border: 1px solid #ccc;
width: 300px;
height: 100px;
}
<object type="text/plain" data="data:text/plain;base64,SGVsbG8gV29ybGQh">
<embed type="text/plain" src="data:text/plain;base64,SGVsbG8gV29ybGQh" />
</object>
All the PDFs look ok (the browser loads them using the plugin), but I am facing some trouble with the text files. The content of the .txt is displayed correctly, but the text looks a bit small and I was asked to make it larger.
I tried changing the font size of the object and embed but the content is not affected by it:
object, embed {
font-size: 32px;
}
In Chrome, I saw that the content of the object is a #document that displays the content of the base64 .txt in a pre. So I tried to style the pre, but only the pre tags outside the object tag take them, not the one inside it:
pre {
font-size: 32px;
}
Is it possible to give styles to the content of an object/embed? How could it be done?
Here is a pseudo-solution that worked for me in firefox (locally) and not chrome. The idea is to access the content of the object and append to its head a custom CSS. The issue with this solution is that you will face cross-origin issue in some browser as the object behave like an iframe that includes an external content.
NB: i used the setTimeout to be sure i run the function after the content of the object is loaded
function addCss() {
$('object').contents().find("head").append($("<style type='text/css'>pre{font-size:32px;}</style>"));
}
setTimeout(function(){addCss()},2000);
object {
border: 1px solid #ccc;
width: 300px;
height: 100px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<object type="text/plain" data="data:text/plain;base64,SGVsbG8gV29ybGQh">
<embed type="text/plain" src="data:text/plain;base64,SGVsbG8gV29ybGQh" />
</object>
Maybe your problem will be how to avoid this cross-origin issue since the content will be yours and server from the same site.
I'm trying to figure out what file the styling for FCKeditor's WYSIWIG editor is located.
This is a sample WYSIWIG iframe:
<iframe id="edit-field-location-0-value___Frame" height="100%" frameborder="0" width="100%" scrolling="no" src="/sites/all/modules/fckeditor/fckeditor/editor/fckeditor.html?InstanceName=edit-field-location-0-value&Toolbar=Default" style="margin: 0px; padding: 0px; border: 0px none; background-color: transparent; background-image: none; width: 100%; height: 100%;">
I want to modify the height, but I just can't seem to find the file, or any documentation on this. Does anyone have any information?
Hah someone is still using the old module/editor (why?) o.O :-)
Considering that the editor is alrrady dead, same with the FCKeditor module for Drupal, I suggest taking the most easy path - altering the FCKeditor module
Find the following line in fckeditor.module:
// sensible default for small toolbars
$height = intval($element['#rows']) * 14 + 140;
and try setting height to any other value. I do not have this module installed, but that would be my first guess.
On my site, I recently found a strange new automatically generated div. when I look at it in development tools in chrome I says:
<div id="dp_swf_engine" style="position: absolute; width: 1px; height: 1px;"><embed style="width: 1px; height: 1px;" type="application/x-shockwave-flash" src="http://www.ajaxcdn.org/swf.swf" width="1" height="1" id="_dp_swf_engine" name="_dp_swf_engine" bgcolor="#336699" quality="high" allowscriptaccess="always"></div>
I really don't know what it is, and where it's coming from.
I already had a similar problem and the div came from a chrome extension, check which extension can modify your pages.
Sometimes it will be automatically adding from your web hosting
server
If you are using an external plugins it will be coming from it
I could see you are using google fonts.... Try removing and check your site
You can run your website on a local server...
To hide the DIV, Try adding this css:
<style type="text/css">
dp_swf_engine {
display:none;
}
</style>
Thanks
On the document ready event :
var element = document.getElementById("dp_swf_engine");
document.body.removeChild(element)
if your div is directly in your body element else, find his parent for call removeChildFunction...
I hope that help !